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.


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. Thanks! This worked perfectly!

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

  3. thanks

  4. define(‘WPCF7_AUTOP’, false );

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

  5. 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’ );

  6. Thanhk you very much !

  7. Awesome, thanks!

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

    ??????? !

  9. Thanks

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

    Big thank you! That does the trick!

  11. 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!