Internet
How to
Newspapers
Twitter
SEO advice
Categories: How to, Wordpress. Tags:

WordPress and smart/curly quotes: turning them off

November 15, 2009 2 Comments

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. Ignore WordPress’s SEO advice
  3. Avoid duplicate content with paged comments in wordpress
  4. Can you use rel = canonical to fix duplicate comment problems caused by comment pagination in wordpress?
  5. Unique meta description and meta keyword tags in your WordPress themes

Share this post

Follow me on Facebook or Twitter

2 Comments »

Leave a comment!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.