How to Disable Smart / Curly Quotes on WordPress

This is a programmer blog, so I occasionally post code. Everyone who ever copy/pasted code from a blog will most likely ran into the issue where the code didn't work because the blogging software replaced quotes like " and ' with some funky, curly quotes. That is perfectly acceptable for Blogs that only contain essays, but completely unacceptable for blogs that contain code.

Luckily, there is a way to remove that function - thanks to Peter Çoopèr for pointing that out! In your Dashboard, go to Appearance => Editor and edit your functions.php to include these two lines before the closing ?>:

remove_filter('the_content', 'wptexturize');
remove_filter('comment_text', 'wptexturize');

Voilá, quotes are quotes again! This works with newer WordPress versions, I'm using it at 2.9.1 at the time of writing.

Comments (3)

KonradJanuary 7th, 2010 at 21:35

Beware that an update of WP will remove all your changes from the core files. I learned this the hard way. Luckily, I had made a patch file that I could apply but the automatic WP update is a PITA if you want to maintain your own changes to the WP codebase as well.

mstumJanuary 7th, 2010 at 22:21

Good Point, ran into that too. It works well if you have your own theme, even if it's just a copy of the default Theme. WP Update will touch it's own themes, but not custom ones. Of course, you have to check if there's any new functionality, but apart from the Widgets support a few versions back, nothing big changed.

bitkahunaSeptember 27th, 2011 at 07:44

this was exactly the info i needed to make "Allow PHP in posts and pages" plugin (awesome by the way) work right.