Last active
August 29, 2015 14:24
-
-
Save mohsinrasool/46d403ac5b822837d899 to your computer and use it in GitHub Desktop.
WP Queries to fix weird characters (i.e., – = em dash, and — = en dash) in posts and pages
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
-- Try 1: | |
-- Change DB_CHARSET from utf-8 to latin1 in wp-config.php | |
-- define('DB_CHARSET', 'latin1'); | |
-- Try 2: | |
-- Clean up 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_posts SET post_content = REPLACE(post_content, '…', '…'); | |
UPDATE wp_posts SET post_content = REPLACE(post_content, 'é', 'é'); | |
-- Clean up post title | |
UPDATE wp_posts SET post_title = REPLACE(post_title, 'é', 'é'); | |
-- Clean up 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, '•', '-'); | |
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