WordPress.org

Ready to get started?Download WordPress

Forums

Contact Form 7
[resolved] after update to 3.7.1 again getting error undefined function wpcf7_add_shortcode (8 posts)

  1. Mohammad Sabbagh
    Member
    Posted 5 months ago #

    when i update the plugin from 3.6 to 3.7 i got the error undefined function wpcf7_add_shortcode

    later on i found the solution here

    http://wordpress.org/support/topic/after-update-undefined-function-wpcf7_add_shortcode

    i get again the same error after i update to 3.7.1

    any suggestions

    https://wordpress.org/plugins/contact-form-7/

  2. Takayuki Miyoshi
    Member
    Plugin Author

    Posted 5 months ago #

    Try deactivating all other plugins and switching to the default theme. If you don't see the error after that, reactivate them one by one.

  3. Mohammad Sabbagh
    Member
    Posted 4 months ago #

    Thanks Takayuki

    i think i found the cause of the problem is when i update or deactivate the plugin, the error show because

    wpcf7_add_shortcode function wont be there

    THE SOLUTION i found

    if ( is_plugin_active( 'contact-form-7/contact-form-7.php' ) ) {
    wpcf7_add_shortcode(...
    }

  4. wpforum1
    Member
    Posted 4 months ago #

    [Moderator Note: Please do not post in uppercase & shout at us. Post de-capped.]

    Hello Mohammad Sabbagh ,

    please we add this coe where ?

    the solution i found

    if ( is_plugin_active( 'contact-form-7/contact-form-7.php' ) ) {
    wpcf7_add_shortcode(...
    }

    thank you

  5. Mohammad Sabbagh
    Member
    Posted 4 months ago #

    in "function.php" template file

    explaining:

    before few versions of this plugin we used to write for example:

    wpcf7_add_shortcode( 'guest', 'wpcf7_text_shortcode_handler', true );

    or

    add_action( 'init', 'xxxxx_wpcf7_add_shortcode' );
    
    function xxxxx_wpcf7_add_shortcode() {
    wpcf7_add_shortcode( 'guest', 'wpcf7_text_shortcode_handler', true );
    }

    Later on this code cause error when u update or disable the plugin
    so i found checking if the plugin is active will solve the issue
    as following

    if ( is_plugin_active( 'contact-form-7/contact-form-7.php' ) ) {
    wpcf7_add_shortcode( 'guest', 'wpcf7_text_shortcode_handler', true );
    }
  6. Mohammad Sabbagh
    Member
    Posted 4 months ago #

    Sorry it seems my solution is not correct

    i will be back if i found good solution

  7. Mohammad Sabbagh
    Member
    Posted 4 months ago #

    anyway this error shows only when you update the plugin

    so for now you can comment this line while updating

    //wpcf7_add_shortcode( 'guest', 'wpcf7_text_shortcode_handler', true );

  8. Mohammad Sabbagh
    Member
    Posted 4 months ago #

    can you try this it works for me

    if ( function_exists( 'wpcf7_add_shortcode' ) ) {
       wpcf7_add_shortcode( 'guest', 'wpcf7_text_shortcode_handler', true );
    }

Reply

You must log in to post.

About this Plugin

About this Topic