Include Custom Shortcodes in Contact Form 7

By default, Contact form 7 plugin doesn’t allow you to execute your custom shortcodes inside contact forms. But you can easily fix this issue by adding a handy WordPress code snippet in your functions.php file located inside your theme folder.

Must Read : How To Get Last Login Time In WordPress?

To use custom shortcodes within your contact form 7 plugin, use the following code.

function shortcodes_in_cf7( $form ) {
	$form = do_shortcode( $form );
	return $form;
}
add_filter( 'wpcf7_form_elements', 'shortcodes_in_cf7' );

 

0 Comments

Leave a Comment.