Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save omurphy27/5166529 to your computer and use it in GitHub Desktop.
Save omurphy27/5166529 to your computer and use it in GitHub Desktop.
PHP Wordpress Removing Contact Form 7 Br tags when adding to template
<!-- adding Contact Form 7 into Wordpress Template and removing <br> tags
add the following to the wordpress template -->
<?php echo do_shortcode('[contact-form-7 id="211" title="Spanish Contact Form"]') ; ?>
<!-- add the following into the wp-config.php -->
define ('WPCF7_AUTOP', false );
<!-- This will remove the <br> tags that get added automatically when you call Contact Form 7 from the template via shortcode-->
@kunKun-tx
Copy link

for anyone who still has this issue after all these years, just use css to hide those

@aurovrata
Copy link

sweet, thanks for sharing

@blademe
Copy link

blademe commented Jun 6, 2017

What is it with complex problems that we default to complex solutions? Thank you so much for the simplicity in your solution @kunKun-tx!

@omartdev
Copy link

omartdev commented Dec 8, 2017

how i can do if i don't have access to wp-config.php

@enesaltuntas
Copy link

Thanks you :)

@Claytonkuiaski
Copy link

form br{ display: none;}

@vdrover
Copy link

vdrover commented Apr 16, 2018

This is the current hook for WPCF7 5.x and later. Place it in functions.php:

add_filter( 'wpcf7_autop_or_not', '__return_false' );

@mmh4560
Copy link

mmh4560 commented Feb 17, 2019

This is the current hook for WPCF7 5.x and later. Place it in functions.php:

add_filter( 'wpcf7_autop_or_not', '__return_false' );

Awesome.! It's working perfectly. Thank you very much.!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment