Smart Quotes in Code with WordPress and Markdown


So the other day I went to go use some code from my blog on a site I was working on. I went and found the code, copied, pasted and then cried a little.

Somehow somewhere Wordpress got this bright idea to use it's 'texturizeness' on my code.
Not okay. Now I had smart/curly quotes all up in my code's business.

So I had to add the following two lines to my theme's functions.php file to disable this built in WordPress gem

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

I'll either have to find a Smarty Pants plugin that will know better or find a way to turn the wptexturize filter after the Markdown plugin has run.

If you have any ideas or suggestions please respond I'm plum out of ideas though I will still look for a solution.

Popularity: 68% [?]


Write a Comment

Take a moment to comment and tell us what you think. Some basic HTML is allowed for formatting.

Reader Comments

Thanks. I just added your code to the Markdown plugin. I newer version of the plugin should probably do that anyway.

I played around with it filter priorities, and I couldn't figure out a solution where the filters could coexist.