WordPress and smart/curly quotes: turning them off
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
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 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
- Adding page numbers: How to avoid duplicate titles and meta descriptions in pages 2 and higher of WordPress category and tag pages
- Ignore WordPress’s SEO advice
- Avoid duplicate content with paged comments in wordpress
- Can you use rel = canonical to fix duplicate comment problems caused by comment pagination in wordpress?
- Unique meta description and meta keyword tags in your WordPress themes
Thank you! Solution to my problem encoding post titles with apostrophes in my URLs (for Amazon links and such).
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!