Contact Form 7 is a great plugin to make custom contact forms on your WordPress site. If you are using shortcodes in your WordPress site, you may want to make it so they will work in the Contact Form 7 plugin’s contact forms. Just add this WordPress Code Snippet to the functions.php file in your current WordPress theme in order to make it so your shortcodes will work when placed in Contact Form 7 plugin’s contact form.
/** * Allow shortcodes in Contact Form 7 * * @author WPSnacks.com * @link https://www.wpsnacks.com */ function shortcodes_in_cf7( $form ) { $form = do_shortcode( $form ); return $form; } add_filter( 'wpcf7_form_elements', 'shortcodes_in_cf7' );
That’s it, now your shortcodes can be called inside Contact Form 7 forms and will work correctly. Hope this helps, enjoy!
Leave a Reply