Support » Plugin: Contact Form 7 » Shortcode broken in widget after update

  • therjp

    (@therjp)


    After the last update, my contact 7 forms in my widgets (sidebar) now only show the actual shortcode instead of displaying the form.

    Any ideas?

Viewing 14 replies - 1 through 14 (of 14 total)
  • irisvanheusden

    (@irisvanheusden)

    Same deal here.

    I love the widget but it is the worst time for me to break down expecting website traffic after an exposition this weekend.

    i’m currently trying to revert back to 5.05 but cant locate a download for that.

    cdeltoro

    (@cdeltoro)

    I’m encountering the same issue. Any ideas?

    therjp

    (@therjp)

    They just updated the plugin today but the problem persists 🙁

    linux4me2

    (@linux4me2)

    Try a default theme and see if the CF 7 shortcodes work.

    In default themes, the CF 7 shortcodes still work for me, but I recall that in some themes in the past, you had to add the following to the functions.php of your child theme to get shortcodes to work in the Text widget:

    
    add_filter( 'widget_text', 'do_shortcode' );
    

    You might give that a try and see if it works for you.

    eehmke

    (@eehmke)

    The shortcode is not used anymore and should be ignored. You can delete it. But this is only the minor part of the problem. Version 5.1.1 should solve this, but has not be confirmed.

    linux4me2

    (@linux4me2)

    I think the OP is talking about his actual CF 7 forms, not the “[recaptcha]” tag:

    my contact 7 forms in my widgets (sidebar) now only show the actual shortcode instead of displaying the form.

    But maybe I’m wrong…

    therjp

    (@therjp)

    Correct, the actual contact form 7 shortcode you use in posts or widgets to display a form… for example: [contact-form-7 id=”xxxx” title=”sidebar contact form”]

    This works in posts still, but not in widgets after update.

    I will try this functions adjustment recommended by linux4me2…

    therjp

    (@therjp)

    Holy moly bless your soul… that functions.php add worked! Thanks so much!

    linux4me2

    (@linux4me2)

    I’m glad you got it working. I wish I knew why it broke. I wouldn’t think it would be the CF 7 update. Maybe WP 5.0.x?

    therjp

    (@therjp)

    Yes could be as I did also update WP around the same time.

    irisvanheusden

    (@irisvanheusden)

    thanks linux4me2

    The functions.php solution worked for me as well.

    cheers mate

    Update WP 5.0.x not associated with the failure shortcode CF in widget.
    WP 5.0.x + CF 5.0.5 = work.
    WP 5.0.x + CF 5.1.1 = it does not work.

    sqproductions

    (@sqproductions)

    Thanks @linux4me2, the functions add worked for me, as well.

    linux4me2

    (@linux4me2)

    @freelancelab, I think you are correct. It looks like CF 7 5.0.5 has the following code in /includes/controller.php that is missing in CF 7 5.1.1:

    
    add_filter( 'widget_text', 'wpcf7_widget_text_filter', 9 );
    
    function wpcf7_widget_text_filter( $content ) {
    	$pattern = '/\[[\r\n\t ]*contact-form(-7)?[\r\n\t ].*?\]/';
    
    	if ( ! preg_match( $pattern, $content ) ) {
    		return $content;
    	}
    
    	$content = do_shortcode( $content );
    
    	return $content;
    }
    
Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Shortcode broken in widget after update’ is closed to new replies.