Nov 11
icon1by Gilmar Jimeno | Wordpress | 1 comment
Wordpress Tip/Hack

Generally, one of the annoying features of the popular blogging platform Wordpress, is its automatic correction and presumed way of editing the HTML code you insert in creating your posts. For instance if you place a <br> tag in your HTML code, Wordpress will then try to replace it with the <p> tag. Worse is that it sometimes add the closing tag, </p>, in the end of already closed tags with no substantial reasons when in fact you have already written the code correctly.

The Wordpress functions wpautop (which handles the automatic insertion of the paragraph or <p> tags) and the wptexturize (adds curly quotes and sometimes changes symbols in order to make it look “prettier” which later causes your output to behave unsually). If you are a person who often checks your site with the W3C's Markup and CSS standards, then those two functions will make your way a little bit harder in complying with those standards. So what can you do to avoid those unusual effects of the functions? One solution perhaps is to disable the two functions. This could be a harsh way but this will also yield better benefits on your part. The solution is here.

Open your theme's function.php file, and simply insert the follwing code between (or inside) <?php and ?>:

//disable auto p
remove_filter ('the_content', 'wpautop');

//disable wptexturize
remove_filter('the_content', 'wptexturize');

That's it! I hope you find this helpful.

   
 

I agree with that, I have experienced that too. That auto-correction also makes me confuse on my code.

 
Want an avatar?

Go to gravatar.com and upload your preferred avatar.