• 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)
  • 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.

    I’m encountering the same issue. Any ideas?

    Thread Starter therjp

    (@therjp)

    They just updated the plugin today but the problem persists ??

    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.

    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.

    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…

    Thread Starter 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…

    Thread Starter therjp

    (@therjp)

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

    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?

    Thread Starter therjp

    (@therjp)

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

    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.

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

    @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.