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-->
@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