Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save omurphy27/5166529 to your computer and use it in GitHub Desktop.

Select an option

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
Copy Markdown

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

@aurovrata
Copy link
Copy Markdown

sweet, thanks for sharing

@blademe
Copy link
Copy Markdown

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
Copy Markdown

omartdev commented Dec 8, 2017

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

@enesaltuntas
Copy link
Copy Markdown

Thanks you :)

@Claytonkuiaski
Copy link
Copy Markdown

form br{ display: none;}

@vdrover
Copy link
Copy Markdown

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
Copy Markdown

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

@MladenJanjetovic
Copy link
Copy Markdown

add_filter( 'wpcf7_autop_or_not', '__return_false' );

This is much better. Can be done within a theme files.

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