Remove p and br tags from Contact Form 7
Contact Form 7 can add extra <p>
and <br>
tags into forms, but it’s easy enough to put a stop to.
Removing excess WPCF7 tags
The Contact Form 7 plugin makes forms in WordPress super easy, but depending on your layout you might see a few extra <p>
or <br>
tags thrown in there.
If CF7 does throw some stray paragraphs or line-breaks into your code you can either target them with your CSS to hide them, or throw this little snippet into your wp-config.php file.
define('WPCF7_AUTOP', false );
Make sure that this goes into your wp-config.php file – a few folks have tried to pop this into the functions file, but it won’t work as-is.