How to turn off WordPress smart quotes

Post image for How to turn off WordPress smart quotes

by bledsoe on January 30, 2010

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:

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.

Previous post:

Next post: