X

How to Remove <p> and <br /> from Contact Form 7

Snippets by IsItWP

Are you looking for a way to remove all of the extra <p> and <br /> from your forms? Contact form 7 is a great tool but sometimes it adds a little extra HTML that you might want to get rid off within your pages and posts. We have created a quick code snippet that you can use to remove <p> and <br /> from Contact Form 7.

Instructions:

All you have to do is add this code to your wp-config.php file:

define('WPCF7_AUTOP', false );

Note: If this is your first time adding code snippets in WordPress, then please refer to our guide on how to properly add code snippets in WordPress, so you don’t accidentally break your site.

If you liked this code snippet, please consider checking out our other articles on the site like: 6 best Stripe payment plugins for WordPress and how to create a review site in WordPress.

Comments   Leave a Reply

  1. This is working fine for me for the frontend of the site but not working for the contact form submission emails.

    Can someone please help me with this?

    Thank you

  2. That solved my problem with extra in Contact Form 7 perfectly.

  3. Thanks! This worked perfectly!

  4. Thanks, it fix the forms after I update the plugin that break the form I build

  5. thanks

  6. define(‘WPCF7_AUTOP’, false );

    This code should be placed inside the wp-config.php not functions.php

  7. Why It’s not working for me. ??
    And I’m using this code and It’s working fine.

    add_filter( ‘wpcf7_autop_or_not’, ‘__return_false’ );

  8. Thanhk you very much !

  9. Awesome, thanks!

  10. ????????? ???????? February 8, 2018 at 1:47 pm

    ??????? !

  11. Thanks

  12. Andrés Jorge Paz-Soldán Somoza September 18, 2017 at 6:54 pm

    Big thank you! That does the trick!

  13. Thanks a mill!

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WordPress Launch Checklist

The Ultimate WordPress Launch Checklist

We've compiled all the essential checklist items for your next WordPress website launch into one handy ebook.
Yes, Send Me the Free eBook!