morganestes
11/20/2011 - 6:20 AM

Run this when you see weird crap in your posts/comments after moving your WordPress install.

Run this when you see weird crap in your posts/comments after moving your WordPress install.

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_excerpt = replace(post_excerpt,'’','\'');

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_excerpt = replace(post_excerpt,'…','...');

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_excerpt = replace(post_excerpt,'–','-');

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_excerpt = replace(post_excerpt,'“','"');

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_excerpt = replace(post_excerpt,'‘','\'');

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_excerpt = replace(post_excerpt,'•','-');

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_excerpt = replace(post_excerpt,'‡','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_excerpt = replace(post_excerpt,'â€','"');

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_excerpt = replace(post_excerpt,'Â','');