How to Disable WordPress Curly Quotes and Apostrophes

If you blog about cats, dogs and the weather, having curly quotes on your site may sound like a great addition. However, if you blog about stuff like Linux commands for example they may ruin your life. Furthermore, you can even do some proper damage pasting such command to a *nix environment because only part of it will be executed.

To disable them completely, you need to add these lines to your functions.php file:

remove_filter(‘comment_text’, ‘wptexturize’);
remove_filter(‘the_excerpt’, ‘wptexturize’);
remove_filter(‘the_content’, ‘wptexturize’);

That’s not all unfortunatelly. If you already have added  posts with the “curlified” quotes, you need to replace them in your database. To do this, open a phpMyAdmin tool and use these queries to replace the curly quotes and the apostrophe:

UPDATE `wp_posts` SET `post_content` = replace(post_content, ‘“’, ‘”‘)

UPDATE `wp_posts` SET `post_content` = replace(post_content, ‘’’, ‘\”)

That’s it! You are curly quotes-free now!

Leave a Reply

Close Menu

Privacy Preference Center