WordPress – Remove auto adding of – wpautop

I created a page in WordPress, switched to Text mode and added some HTML and Javascript code.  All should be good, right?

Well WordPress started to add some tags wherever it felt like…  So my clean HTML was becoming dirty WordPress HTML as I call it…  frustrating, right?  So what’s a good blog developer to do?

Thanks to some searching, I found one reference that fit the trick.  In the PHP template file for my page layout I was using, I simply added this line of code to the top of the page.

That’s it!  I’m sure there are many other ways you could find to integrate this into the site, but for my needs this was perfect.

So what is it?

Well in doing some digging, WordPress has a filter that turns double line breaks into HTML elements for spacing.
http://codex.wordpress.org/Function_Reference/wpautop

While they see this as a feature – and it very well might be for those that don’t get code as well as I do – I found it annoying that WordPress is modifying my HTML when I never asked it to!

So pretty simple fix and allowed me to keep as many of the hairs on my already thinning head as possible.

Happy WordPress themeing!!!!