Skip to content

Instantly share code, notes, and snippets.

@mmizwicki
Forked from ramseyp/character-cleanup.sql
Last active January 3, 2016 10:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mmizwicki/8450416 to your computer and use it in GitHub Desktop.
Save mmizwicki/8450416 to your computer and use it in GitHub Desktop.
## Run this in phpMyadmin
##
## Cleans up Posts table
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, 'Â', '');
UPDATE wp_posts SET post_content = REPLACE(post_content, 'é', 'é');
##
##
## Cleans up Posts Title
##
UPDATE wp_posts SET post_title = REPLACE(post_title, '“', '“');
UPDATE wp_posts SET post_title = REPLACE(post_title, '”', '”');
UPDATE wp_posts SET post_title = REPLACE(post_title, '’', '’');
UPDATE wp_posts SET post_title = REPLACE(post_title, '‘', '‘');
UPDATE wp_posts SET post_title = REPLACE(post_title, '—', '–');
UPDATE wp_posts SET post_title = REPLACE(post_title, '–', '—');
UPDATE wp_posts SET post_title = REPLACE(post_title, '•', '-');
UPDATE wp_posts SET post_title = REPLACE(post_title, '…', '…');
UPDATE wp_posts SET post_title = REPLACE(post_title, 'Â', '');
UPDATE wp_posts SET post_title = REPLACE(post_title, 'é', 'é');
##
##
## Cleans up Posts Excerpt
##
UPDATE wp_posts SET post_excerpt = REPLACE(post_excerpt, '“', '“');
UPDATE wp_posts SET post_excerpt = REPLACE(post_excerpt, '”', '”');
UPDATE wp_posts SET post_excerpt = REPLACE(post_excerpt, '’', '’');
UPDATE wp_posts SET post_excerpt = REPLACE(post_excerpt, '‘', '‘');
UPDATE wp_posts SET post_excerpt = REPLACE(post_excerpt, '—', '–');
UPDATE wp_posts SET post_excerpt = REPLACE(post_excerpt, '–', '—');
UPDATE wp_posts SET post_excerpt = REPLACE(post_excerpt, '•', '-');
UPDATE wp_posts SET post_excerpt = REPLACE(post_excerpt, '…', '…');
UPDATE wp_posts SET post_excerpt = REPLACE(post_excerpt, 'Â', '');
UPDATE wp_posts SET post_excerpt = REPLACE(post_excerpt, 'é', 'é');
##
##
## Cleans up Comments
##
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, '…', '…');
UPDATE wp_comments SET comment_content = REPLACE(comment_content, 'Â', '');
UPDATE wp_comments SET comment_content = REPLACE(comment_content, 'é', 'é');
##
##
## Cleans up User Meta (descriptions)
##
UPDATE wp_usermeta SET meta_value = REPLACE(meta_value, '“', '“');
UPDATE wp_usermeta SET meta_value = REPLACE(meta_value, '”', '”');
UPDATE wp_usermeta SET meta_value = REPLACE(meta_value, '’', '’');
UPDATE wp_usermeta SET meta_value = REPLACE(meta_value, '‘', '‘');
UPDATE wp_usermeta SET meta_value = REPLACE(meta_value, '—', '–');
UPDATE wp_usermeta SET meta_value = REPLACE(meta_value, '–', '—');
UPDATE wp_usermeta SET meta_value = REPLACE(meta_value, '•', '-');
UPDATE wp_usermeta SET meta_value = REPLACE(meta_value, '…', '…');
UPDATE wp_usermeta SET meta_value = REPLACE(meta_value, 'Â', '');
UPDATE wp_usermeta SET meta_value = REPLACE(meta_value, 'é', 'é');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment