Stop Wordpress adding <br/> tags

Been swearing at Wordpress this afternoon…

I’ve been trying to transfer an html form, which I had working perfectly on a static html page, onto a Wordpress page. Wordpress insisted on adding multiple <br/> tags where I didn’t want them. Mutter.

Eventually, after much searching, I identified a parameter within wp-includes/formatting.php, which allows you to disable this irritating feature. If you open formatting.php and find the function wpautop you’ll see this:

function wpautop($pee, $br = 1)

Change this to:

function wpautop($pee, $br = 0)

Save the file and publish it back to your server and that’s it. Works fine in WP2.8.

Note: WP 2.8.3 overwrites formatting.php so this change needs redoing.

Tags: ,

4 responses to “Stop Wordpress adding <br/> tags”

  1. Lima says:

    cheers, mate!

  2. Great solution! It works perfectly! Thanks for sharing!

  3. I can now stop headbutting the desk – until the next update.

  4. Don says:

    Awesome. I too was doing some headbutting. $#%!!!

    Thanks a lot for posting this solution!

Useful? Interesting? Leave me a comment