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.
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');
This disables the Texturize filter for comments, the excerpt and the content of the blog.
Advertisement
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.