Turning Off Wordpress “Smart Quotes”
July 16, 2008 8:11 am GeneralI just realized today that Wordpress was converting my "straight" quotes into directional or so-called "smart" quotes. While this may be nice for nontechnical blogs, it's a pain in a programming-related blog. It can make a block of sample code useless when you copy and paste it until you go through it and convert those directional quotes back into the straight quotes normally used in most programming languages.
Fortunately, a little Googling quickly found this forum entry with a suggested fix. I used Otto42's suggestion:
Smart quotes are performed by the wptexturize function. You can disable them by determining what the filter is and disabling it in your theme.
Example: Your post content is filtered through "the_content". So you want to turn off wptexturize for that filter. You do so by adding this to your theme's functions.php file:
remove_filter('the_content', 'wptexturize');
This appears to be doing the trick. Now I have to go through all my posts and edit any with smart quotes in the code samples. *Sigh* Anyway, hope that tip helps someone else out there who's run into this "feature".
PS: It appears that Wordpress version 2.6 just came out, so I'll be looking into what that entails and probably upgrading soon.
PPS: Looks like the smart-quoting was applied on the output stage and not the input stage, so it appears that little one-line fix took care of the issue.
PPPS: The upgrade to Wordpress 2.6 has been completed.
