Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Takayuki Miyoshi

    (@takayukister)

    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.

    Thread Starter Mohammad Sabbagh

    (@sabbagh)

    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(…
    }

    wpforum1

    (@wordpressforum1)

    [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

    Thread Starter Mohammad Sabbagh

    (@sabbagh)

    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 );
    }
    Thread Starter Mohammad Sabbagh

    (@sabbagh)

    Sorry it seems my solution is not correct

    i will be back if i found good solution

    Thread Starter Mohammad Sabbagh

    (@sabbagh)

    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 );

    Thread Starter Mohammad Sabbagh

    (@sabbagh)

    can you try this it works for me

    if ( function_exists( 'wpcf7_add_shortcode' ) ) {
       wpcf7_add_shortcode( 'guest', 'wpcf7_text_shortcode_handler', true );
    }
Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘after update to 3.7.1 again getting error undefined function wpcf7_add_shortcode’ is closed to new replies.