Skip to content

Instantly share code, notes, and snippets.

@madeingnecca
Created September 26, 2012 19:43
Show Gist options
  • Save madeingnecca/3790129 to your computer and use it in GitHub Desktop.
Save madeingnecca/3790129 to your computer and use it in GitHub Desktop.
WORDPRESS db utils
# Reset post metas.
delete from wp_postmeta where post_id in (select ID from wp_posts where post_type in('attachment','revision','post'))
# Reset posts.
delete from wp_posts where post_type in('attachment','revision','post')
# Migrate blog, from domainOLD.com to domain.com.
update wp_options set option_value = 'http://domain.com' where option_name = 'siteurl';
update wp_options set option_value = 'http://domain.com' where option_name = 'home';
update wp_posts set guid = replace(guid, 'http://domainOLD.com', 'http://domain.com');
update wp_posts set post_content = replace(post_content, 'http://domainOLD.com', 'http://domain.com');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment