Allow Shortcode Usage In Contact Form 7

Normally if you have shortcodes, it will be displayed as text (string) in Contact Form 7 fields unless you allow.

It’s because your shortcode echoes the output than returning it — shortcodes should not echo the output, but return it — unless in certain cases like complex HTML markup in the output, where you need to use output buffering.

You can place only the following code in functions.php and it will work:

// Activate Shortcode Execution for Contact Form 7

add_filter( 'wpcf7_form_elements', 'do_shortcode' );

Related Posts