Remove P tags from Contact Form 7 forms

I love Contact Form 7 and use it on 99% of my client and my own sites. It’s simple, lightweight and does a perfect job for mail.

Depending on the form you use, you sometimes need to remove the <p> and <br> tags that appear in the form, which are auto-generated by the plugin. While you can try and work around it by removing margins or hiding them with CSS, you will often still see empty <p> and <br> tags in the form which can take more time to hide or remove.

Removing these tags is simple and only needs a single line adding into the wp-config.php file. I usually add this just underneath the WP_DEBUG line. Heres all you need to add:

define ('WPCF7_AUTOP', false);

This will remove all <p> and <br> tags added by the plugin, allowing you to style the form exactly how you want it.

Useful post? Share it

Leave a Reply

Your email address will not be published. Required fields are marked *