Created
March 12, 2015 21:00
-
-
Save bhubbard/584dfe7e3572c32a9e5b to your computer and use it in GitHub Desktop.
Clean up your WordPress database from weird characters Encoding problems can be really painful. Instead of manually update all of your posts, here is a query that you can run in order to clean your database from weird characters.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, '…', '…'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment