How To Fix WordPress Quotation Marks

I was going through a previous post to check how to increase the memory limit on a WordPress install.

When I copied the code, I realized there was a big problem: WordPress was automatically changing "straight quotes" into "smart quotes".

How to fix WordPress quotation marks: Go to functions.php and add this code: remove_filter('the_content', 'wptexturize');

You're changing this:

Into this:

To change WordPress "Smart Quotes" to straight quotes in the titles, add this code to functions.php: remove_filter('the_title', 'wptexturize');

You don't notice the smart quotes when you're writing, because WordPress only switches it on display.

The straight quotes are saved to the database, regardless of whether you remove the wptexturize filter or not.

There's a plugin that claims to fix these smart quotes before they hit the database, but that's not how WordPress does it any more. No need for it, just add one line to your functions.php.

Why use straight quotes rather than smart quotes?

Ordinarily, it doesn't really matter which style you use. It will usually just come down to personal preference.

If you're posting code, like I am on this site, having smart quotes will cause issues with anyone who copies and pastes your code.

wptexturize doesn't just affect quotes. It also changes dashes and ellipses, among other things. See the WordPress reference for everything it changes.

Leave a Comment