Before all, I've searched a way to done this. But it still occure.
So I use the theme Creative, I've got a contact form, done with Contact Form 7. And to display it in the right place, it need to be placed in a widget aera.
I've inserted the shortcode of the form in a text widget, in a widget for shortcode, and also in a widget for Contact Form 7.
For every case, the inputs and label are wrapped into p
tag, and it brake the submit function, I guess.
So I've tried a fiew things to disable this function.
In my function.php, at the end :
//* Disable automatic p tag insertion
remove_filter( 'the_content', 'wpautop' );
remove_filter('the_excerpt', 'wpautop');
add_filter( 'the_content', 'disable_wpautop_cpt', 0 );
function disable_wpautop_cpt( $content ) {
'your_cpt_slug' === get_post_type() && remove_filter( 'the_content', 'wpautop' );
return $content;
}
In my wp-config.php, at the end too :
/** Disable automatic p tag insertion */
define( 'WPCF7_AUTOP', false );
And more, I added a plugin to disable this function of WP on the page where the form is.
But the tags are still there. Help
EDIT : Added screen.
Use wpautop filter for remove auto p tags in content or the_excerpt
Example:
More Ref : https://codex.wordpress.org/Function_Reference/wpautop
Add this in your functions.php file
Then on your post editor wrap your contact form 7 shortcode with raw shortcode e.g.