Fix Weird WordPress Characters: ”, “, ’, ‘

”, “, ’, ‘If you’re anything like me, you occasionally have to re-import your WordPress blog database into your [new] server.  For whatever reason, WordPress imports the database and replaces all apostrophes, quotation marks and other characters into weird, unrecognizable gibberish.  You might recognize these characters as ”, “, ’, ‘ and plenty more.  Luckily, I found a great fix for this from a friendly blog on the web.

Simply login to your phpMyAdmin (usually from your control panel, aka Cpanel in most cases), select the WordPress database, then select ‘SQL’ at the top navigation bar.

How to modify your WordPress database to fix the weird characters

In the SQL query field, enter the following:


UPDATE wp_posts SET post_content = REPLACE(post_content, '“', '“');
UPDATE wp_posts SET post_content = REPLACE(post_content, '”', '”');
UPDATE wp_posts SET post_content = REPLACE(post_content, '’', '’');
UPDATE wp_posts SET post_content = REPLACE(post_content, '‘', '‘');
UPDATE wp_posts SET post_content = REPLACE(post_content, '–', '–');
UPDATE wp_posts SET post_content = REPLACE(post_content, '—', '—');
UPDATE wp_posts SET post_content = REPLACE(post_content, '-', '-');
UPDATE wp_posts SET post_content = REPLACE(post_content, '…', '…');
UPDATE wp_comments SET comment_content = REPLACE(comment_content, '“', '“');
UPDATE wp_comments SET comment_content = REPLACE(comment_content, '”', '”');
UPDATE wp_comments SET comment_content = REPLACE(comment_content, '’', '’');
UPDATE wp_comments SET comment_content = REPLACE(comment_content, '‘', '‘');
UPDATE wp_comments SET comment_content = REPLACE(comment_content, '–', '–');
UPDATE wp_comments SET comment_content = REPLACE(comment_content, '—', '—');
UPDATE wp_comments SET comment_content = REPLACE(comment_content, '-', '-');
UPDATE wp_comments SET comment_content = REPLACE(comment_content, '…', '…');

Source

Hit ‘Go’. Your window should refresh and show you what and how the query affected your database. That’s it! Go to your blog, refresh, and look at the cleanliness.

SQL Query for WordPress

For me, I had over 50 fixes. A great little SQL script for anyone.

Need an SEO Consultant for your Local Business in Chicago? Contact me today for a free initial SEO consultation for local business owners in Chicago and Chicagoland area.
or
Download my 2016 SEO Best Practices Guide for some free tips!

No Comments - Leave a comment

Leave a Reply

Your email address will not be published. Required fields are marked *

*