Wordpress plugin Contact Form 7 and line breaks
February 18th, 2009
Summary: Contact Form 7, a Wordpress plugin, automagically adds line breaks (<br />) to the outputted HTML. To disable it, set define('WPCF7_AUTOP', false); in wp-contact-form-7.php.
Problem: When setting up the contact form, the plugin added line breaks between <a> and <span>, which interfered with the CSS layout and styling of the form.
Solution: In the plugin’s folder, the file wp-contact-form-7.php has (line 53):
if (! defined('WPCF7_AUTOP'))
define('WPCF7_AUTOP', true);
Changing the second line from ‘true’ to ‘false’ corrects the unexpected behaviour.
Discussion: The plugin developers obviously recognized that not everyone would want their posts auto-formatted, which is nice. Unfortunately, it isn’t a very well-documented feature.



Superb! This fixed a major difficulty that we were having with an ultra-long form.
(On a side note, do you mean changing ‘true’ to ‘false’ to correct the auto-formatting?)
Thanks again!
You’re right, I copied and pasted *after* I changed it. It’s fixed now, thanks.
Thank you!
Any solutions for allowing the Success Message to support HTML?
ENTER is not breaking the text here. I receive everything inline in my mail program.
And WPCF7_AUTOP is TRUE.
O thank God, this saved me a lot of poking around. I can see how having this would be a quick and simple solution for the average Joe using this form. Not for those who hand craft CSS though.