Skip to content

Instantly share code, notes, and snippets.

@JPry
Created November 7, 2012 15:32
Show Gist options
  • Save JPry/4032257 to your computer and use it in GitHub Desktop.
Save JPry/4032257 to your computer and use it in GitHub Desktop.
Remove funky characters in WordPress database
update wp_posts set post_content = replace(post_content,'’','\'');
update wp_posts set post_title = replace(post_title,'’','\'');
update wp_comments set comment_content = replace(comment_content,'’','\'');
update wp_postmeta set meta_value = replace(meta_value,'’','\'');
update wp_posts set post_content = replace(post_content,'…','...');
update wp_posts set post_title = replace(post_title,'…','...');
update wp_comments set comment_content = replace(comment_content,'…','...');
update wp_postmeta set meta_value = replace(meta_value,'…','...');
update wp_posts set post_content = replace(post_content,'–','-');
update wp_posts set post_title = replace(post_title,'–','-');
update wp_comments set comment_content = replace(comment_content,'–','-');
update wp_postmeta set meta_value = replace(meta_value,'–','-');
update wp_posts set post_content = replace(post_content,'“','"');
update wp_posts set post_title = replace(post_title,'“','"');
update wp_comments set comment_content = replace(comment_content,'“','"');
update wp_postmeta set meta_value = replace(meta_value,'“','"');
update wp_posts set post_content = replace(post_content,'‘','\'');
update wp_posts set post_title = replace(post_title,'‘','\'');
update wp_comments set comment_content = replace(comment_content,'‘','\'');
update wp_postmeta set meta_value = replace(meta_value,'‘','\'');
update wp_posts set post_content = replace(post_content,'•','-');
update wp_posts set post_title = replace(post_title,'•','-');
update wp_comments set comment_content = replace(comment_content,'•','-');
update wp_postmeta set meta_value = replace(meta_value,'•','-');
update wp_posts set post_content = replace(post_content,'‡','c');
update wp_posts set post_title = replace(post_title,'‡','c');
update wp_comments set comment_content = replace(comment_content,'‡','c');
update wp_postmeta set meta_value = replace(meta_value,'‡','c');
update wp_posts set post_content = replace(post_content,'”','"');
update wp_posts set post_title = replace(post_title,'”','"');
update wp_comments set comment_content = replace(comment_content,'”','"');
update wp_postmeta set meta_value = replace(meta_value,'”','"');
update wp_posts set post_content = replace(post_content,'Â','');
update wp_posts set post_title = replace(post_title,'Â','');
update wp_comments set comment_content = replace(comment_content,'Â','');
update wp_postmeta set meta_value = replace(meta_value,'Â','');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment