Remove <p> Tag From Contact Form 7

WordPressPosted on

Contact Form 7 is the most popular free form plugins for WordPress. With CF7, it is easy to make any form that you want.

Although this is an excellent extension, there is some annoying behavior, as always. By default, it is wrapping our rows into <p> tags like in the case of generic posts. Unlike in a post here, this is mostly unusable because we often want a custom layout for our forms which is prevented by the paragraph elements wrap.

Fortunately, it is easy to turn it off, add the following line to your wp-config.php file:

define( 'WPCF7_AUTOP', false );

You can also use a filter in your theme (functions.php) or your plugin:

add_filter('wpcf7_autop_or_not', '__return_false');

The last snippet does the some but it attach the code to the theme and not to the WP instance.

Need a web developer? Maybe we can help, get in touch!

Looking for web dev job?
You can check them on Jooble.

To see and write comments, you must allow the related (Disqus) cookies. For more information, please visit our privacy policy page.

Similar Posts

More content in WordPress category