Title: [Plugin: Contact Form 7] Pull Request
Last modified: August 20, 2016

---

# [Plugin: Contact Form 7] Pull Request

 *  [daveagp](https://wordpress.org/support/users/daveagp/)
 * (@daveagp)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/plugin-contact-form-7-pull-request/)
 * Here is a patch I would like you to include. It would fix an error that is caused
   when you include wp-load.php from an external source other than a page view. 
   It is just to add the line
 * global $wpcf7_shortcode_manager;
 * in contact-form-7/includes/shortcodes.php before the line
 * $wpcf7_shortcode_manager = new WPCF7_ShortcodeManager();
 * Here is a relevant forum post that had exactly this problem:
 * [http://wordpress.org/support/topic/plugin-contact-form-7-cf7-shortcode-error?replies=5](http://wordpress.org/support/topic/plugin-contact-form-7-cf7-shortcode-error?replies=5)
 * and here is the .diff file:
 * Index: trunk/includes/shortcodes.php
    =======================================—
   trunk/includes/shortcodes.php (revision 556777) +++ trunk/includes/shortcodes.
   php (working copy) @@ -166,6 +166,8 @@
 *  }
 * +global $wpcf7_shortcode_manager;
    + $wpcf7_shortcode_manager = new WPCF7_ShortcodeManager();
 *  function wpcf7_add_shortcode( $tag, $func, $has_name = false ) {
 * [http://wordpress.org/extend/plugins/contact-form-7/](http://wordpress.org/extend/plugins/contact-form-7/)

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Thread Starter [daveagp](https://wordpress.org/support/users/daveagp/)
 * (@daveagp)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/plugin-contact-form-7-pull-request/#post-2808700)
 * Sorry for the hassle but I looked a little bit more and found it might be more
   normal to submit a patch on trac, so I did that instead:
 * [http://plugins.trac.wordpress.org/ticket/1534](http://plugins.trac.wordpress.org/ticket/1534)
 * Cheers,
    – Dave
 *  Plugin Author [Takayuki Miyoshi](https://wordpress.org/support/users/takayukister/)
 * (@takayukister)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/plugin-contact-form-7-pull-request/#post-2808750)
 * No, you shouldn’t load wp-load.php manually in plugin code. It can often cause
   conflicts with other plugins.
 * See these threads:
 * [http://wordpress.org/support/topic/plugin-contact-form-7-call-to-undefined-function-wpcf7_add_tag_generator-error?replies=8](http://wordpress.org/support/topic/plugin-contact-form-7-call-to-undefined-function-wpcf7_add_tag_generator-error?replies=8)
 * [http://wordpress.org/support/topic/plugin-nextgen-gallery-conflict-with-contact-form-7?replies=29#post-2874491](http://wordpress.org/support/topic/plugin-nextgen-gallery-conflict-with-contact-form-7?replies=29#post-2874491)
 * [http://wordpress.org/support/topic/plugin-contact-form-7-cf7-breaks-utmce-plugin?replies=9](http://wordpress.org/support/topic/plugin-contact-form-7-cf7-breaks-utmce-plugin?replies=9)
 *  Thread Starter [daveagp](https://wordpress.org/support/users/daveagp/)
 * (@daveagp)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/plugin-contact-form-7-pull-request/#post-2808807)
 * Hi Takayuki,
 * Thank you for your quick reply and many thanks for your awesome plugin.
 * Using admin.php instead of wp-load.php causes this for me: “Fatal error: Call
   to undefined function auth_redirect() in admin.php on line 66”
 * However, having wp-load has always worked fine. As background, the reason that
   I use wp-load is to give some ajax calls the ability to authenticate logged-in
   users and access wpdb. I don’t know another way to do that.
 * Is there any reason that the variable I proposed should not be declared as global?

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘[Plugin: Contact Form 7] Pull Request’ is closed to new replies.

 * ![](https://ps.w.org/contact-form-7/assets/icon.svg?rev=2339255)
 * [Contact Form 7](https://wordpress.org/plugins/contact-form-7/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/contact-form-7/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/contact-form-7/)
 * [Active Topics](https://wordpress.org/support/plugin/contact-form-7/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/contact-form-7/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/contact-form-7/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [daveagp](https://wordpress.org/support/users/daveagp/)
 * Last activity: [13 years, 11 months ago](https://wordpress.org/support/topic/plugin-contact-form-7-pull-request/#post-2808807)
 * Status: not a support question