Smart quotes (aka curly quotes) are what most word processor programs insert into your document when you type the quote marks key. They're pretty to look at, but they cause problems if you use them in a text document that contains code intended to be read by a computer. That's normally not a problem since text editors don't create smart quotes when you type the quote key, but if you happen to find a cool chunk of code on a blog somewhere and you cut and paste it into a text file, if the blog you're copying the code from uses curly quotes, then you have a problem.
The bad news is, WordPress automatically converts all quote symbols to smart quotes, so if you post code snippets to your blog and they have quote marks in them, anyone who attempts to copy and paste that code into their own text file is going to have problems running the code. The good news is, you can turn this feature off.
There are actually a few different ways to do this, including modifying the functions.php file in your theme folder, or modifying the default-filters.php file in your wp-includes folder. But I like creating a separate php file and making it into a WordPress plugin, as described in this post by Katja Stokley. Create a text file called TurnOffSmartQuotes.php and put this in it:
<?php
/*
Plugin Name: TurnOffSmartQuotes
Plugin URI:
Description: Stops WordPress from converting your quote symbols into smartquotes. The three lines below stop the smartquote conversion in 1) your post content, 2) your comments, and 3) your post excerpts.
Version: 0.1
Author: Katja Stokley
Author URI:
*/
remove_filter('the_content', 'wptexturize');
remove_filter('comment_text', 'wptexturize');
remove_filter('the_excerpt', 'wptexturize');
?>
Then just upload this file to your wp-content/plugins folder, login to your WordPress dashboard, select "Plugins," and activate your new plugin. You've just turned off smart quotes on your WordPress blog.
Related posts:
{ 2 trackbacks }
{ 5 comments… read them below or add one }
Interesting, I'll add this option to my existing post about disabling smart quotes
Thanks for sharing.
Fayaz´s last blog ..Amazing Adobe Photoshop CS5 with content aware fill
Excellent, this is exactly what I was looking for: disable smart quotes but without having to edit some default file.
Thanks!
Thanks Fayaz and waldner, glad you found the info helpful.
Hi, i;m have same interesting with you and i found your website from google. You give nice info for wordpress plugin and it's really informatif. Can i copy your post into my blog ?
WordPress Tricks´s last blog ..Post Teaser v401 WP Plugin
Feel free to copy the post if you like, though a link and a shout out is always appreciated.