Where to find Malcolm Coles, reviews, and tips on how to do things I couldn’t do.

malcolm coles


Wordpress and smart/curly quotes: turning them off 2

Posted on November 15, 2009 by Malcolm Coles

Wordpress has some annoying habits. One on my blog is wrapping image divs inside <p> tags, breaking the HTML.

Smart quotes: the problem

Smart quotes

Smart quotes

Another is its habit of replacing normal quote marks with "curly" or smart quotes - the ones that look different at the start of a quote than at the end.

They look nice - but they tend to break copy and paste (especially when you're pasting code, such as my unique wordpress title / description code, and my code to add page numbers to titles in the loop).

SEO issue

I'm a Celebrity - but the I'm wasn't bolded

I'm a Celebrity - but the I'm wasn't bolded

I also noticed that they can interfere with your SEO. I've just written a post about I'm a Celebrity 2009.

However, when it appeared in Google for a search on those words, the I'm in the title wasn't bolded, as this screenshot shows.

Why? Because wordpress had put a smart quote in I'm - and so Google wasn't recognising it as the same word as I'd searched for.

How to fix the smart quote problem

To fix this, you can disable the automatic smart quote function. Go to  your functions.php file, and enter the following code:

remove_filter('the_content', 'wptexturize');

remove_filter('comment_text', 'wptexturize');

remove_filter ('single_post_title', 'wptexturize');

remove_filter ('the_title', 'wptexturize');

remove_filter ('wp_title', 'wptexturize');

You can remove the use of smart quotes in other places, too. There's a complete list here.

NB This didn't completely solve the problem. Although wordpress now doesn't put curly quotes, the apostrophe in the HTML title is still rendered using the HTML entity of ampersand and then #039; - which means Google still won't recognise the word I'm in its results (ie it doesn't bold them etc). Everywhere else, however, wordpress now puts a proper ' instead of an HTML code.

You might also like
  1. Adding page numbers: How to avoid duplicate titles and meta descriptions in pages 2 and higher of Wordpress category and tag pages
  2. Avoid duplicate content with paged comments in wordpress
  3. Can you use rel = canonical to fix duplicate comment problems caused by comment pagination in wordpress?
  4. Unique meta description and meta keyword tags in your Wordpress themes
  5. Breadcrumb navigation trails and Wordpress

You should follow me on Twitter.

2 Responses to “Wordpress and smart/curly quotes: turning them off”

  1. laura says:

    Thank you! Solution to my problem encoding post titles with apostrophes in my URLs (for Amazon links and such).

  2. Sarah says:

    YOU FREAKING ROCK! I have spent days trying to figure out why every freaking apostrophe was showing up as ’ I was going out of my mind! Your fix was so quick and painless. Thank you for posting!

Leave a Reply

All comments are moderated. Comments that include URLs and which just say 'Nice post' or similar won't be published, but thanks for the sentiment.

Find more posts like this



↑ Top