How to make sure Wordpress displays regular quotes in posts - gHacks Tech News

How to make sure WordPress displays regular quotes in posts

I can't really say when those fancy quotes started to appear in posts that I made on this WordPress blog, but one day they were there. I did not really put too much thought into it at that time, but when users started to comment on it, I started to take notice. You see, I sometimes post code or commands that users copy and paste into applications. Maybe a path in quotes followed by a startup parameter for Google Chrome, or a command for the Windows command line.

The problem with stylized quotes is that some programs do not see them as quotes. The consequence is dire, as the command or code is not accepted and at best not working, at worst throwing an error message or turning a working product into something that is not working at all.

The screenshot below highlights how those quotes looked like on this site.

stylized quotes
WordPress using Texturize filter

I first browsed the style.css file of the theme I was using but could not find any reference to quotes in it. It took a while to figure out what was going on. WordPress is using a Texturize filter by default that modifies certain characters when posts are published.

The WordPress codex has a couple of examples. The two that I encountered are turning two dashes into a single dash, and turning standard quotes into stylized quotes instead. There are more however as you can see from the listing below.

"quoted text" becomes “quoted text”
'quoted text' becomes ’quoted text’
--- becomes —
-- becomes –
... becomes …
(c) becomes ©
(r) becomes ®
(tm) becomes ™
'' becomes ”
`` becomes “
president's becomes president’s
presidents' becomes presidents’
12' becomes 12′
12" becomes 12″
2x4 becomes 2×4

The feature is on by default and there is no option to turn it off in the WordPress preferences. You can however turn it off in the following way.

Open the theme folder of the WordPress installation and there the theme that you are currently using. Locate the functions.php file in there and add the following lines of code between <?php ... and ?>

remove_filter('comment_text', 'wptexturize');
remove_filter('the_excerpt', 'wptexturize');
remove_filter('the_content', 'wptexturize');

remove filter wptexturize

This disables the Texturize filter for comments, the excerpt and the content of the blog.


We need your help

Advertising revenue is falling fast across the Internet, and independently-run sites like Ghacks are hit hardest by it. The advertising model in its current form is coming to an end, and we have to find other ways to continue operating this site.

We are committed to keeping our content free and independent, which means no paywalls, no sponsored posts, no annoying ad formats or subscription fees.

If you like our content, and would like to help, please consider making a contribution:

Previous Post: «
Next Post: »


  1. getintopcpw said on November 28, 2017 at 6:15 am

    Pale moon 64-bit is an Open Source, Goanna-based web program accessible for Microsoft Windows What’s more Linus Pauling (with other working frameworks done development), keeping tabs once effectiveness Furthermore simplicity from claiming use.

Leave a Reply

Check the box to consent to your data being stored in line with the guidelines set out in our privacy policy

Please note that your comment may not appear immediately after you post it.

Be polite: we do not allow comments that threaten or harass, or are personal attacks. Please leave politics and religion out of discussions!