Turn Off WordPress Curly Quotes

By default, WordPress attempts to find pairs of single or double quote marks, and converts them to curly quotes, (or “smart quotes” as they’re called — with the one on the left curling one way and the one on the right curling in the other way).

This is all well and good for appearance sake when you’re posting articles made up of paragraphs of text, headings, etc — but is extremely annoying when you’re posting computer programming code examples.

Most computer programming languages extensively use quote marks, (single and double), for formatting and parsing code.

In WordPress, the conversion is done by the wptexturize function.¬† Luckily, you can turn it off in most areas of your blog by locating the specific places and adding a remove_filter() instruction in your template’s functions.php file.

The code below turns off wptexturize for titles, content, (and RSS content).

<?php
// ======================
// turn off smart quotes
// ======================
//
remove_filter('the_content', 'wptexturize');
remove_filter('the_rss_content', 'wptexturize');
remove_filter('the_title', 'wptexturize');
//
?>

Simply cut and paste the above code into your functions.php files, click  Update File, and those curly quotes should be gone.

###

Posted in Wordpress Tagged with: , , , , , , , ,