Created
August 12, 2014 19:35
-
-
Save webdevid/07b948736052f3899507 to your computer and use it in GitHub Desktop.
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_options SET option_value = replace(option_value, 'http://www.old-site.com', 'http://www.new-site.com') WHERE option_name = 'home' OR option_name = 'siteurl'; | |
| UPDATE wp_posts SET guid = replace(guid, 'http://www.old-site.com','http://www.new-site.com'); | |
| UPDATE wp_posts SET post_content = replace(post_content, ' http://www.ancien-site.com ', ' http://www.nouveau-site.com '); |
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
| -- delete spam comments | |
| DELETE from wp_comments WHERE comment_approved = '0'; | |
| -- delete revision | |
| DELETE a,b,c FROM wp_posts a | |
| LEFT JOIN wp_term_relationships b ON (a.ID = b.object_id) | |
| LEFT JOIN wp_postmeta c ON (a.ID = c.post_id) | |
| WHERE a.post_type = 'revision' | |
| -- delete pingback | |
| DELETE FROM wp_comments WHERE comment_type = 'pingback'; | |
| -- identify unused tags | |
| SELECT * From wp_terms wt | |
| INNER JOIN wp_term_taxonomy wtt ON wt.term_id=wtt.term_id WHERE wtt.taxonomy='post_tag' AND wtt.count=0; | |
| -- enable disable pingback | |
| UPDATE wp_posts SET ping_status = 'closed' WHERE post_date < '2012-01-01' AND post_status = 'publish'; | |
| -- delete revision | |
| DELETE FROM wp_posts WHERE post_type = "revision"; | |
| -- remove short codes | |
| UPDATE wp_post SET post_content = replace(post_content, '[short]', '' ) ; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment