Change URL’s on WordPress Database

One of the big problems when migrating a WordPress site from one domain to another is to change the URLs on database

I’ve seen a lot of people despair of it and ask me about how to do this. But here’s a very easy solution with just execute 4 queries in the database:

UPDATE wp_posts SET guid = replace(guid, '','');
UPDATE wp_posts SET post_content = replace(post_content, '', '');
UPDATE wp_links SET link_url = replace(link_url, '', '');
UPDATE wp_links SET link_image = replace(link_image, '', '');
UPDATE wp_postmeta SET meta_value = replace(meta_value, '', '');
UPDATE wp_usermeta SET meta_value = replace(meta_value, '', '');

/*UPDATE wp_options SET option_value = replace(option_value, '', '') WHERE option_name = 'home' OR option_name = 'siteurl' OR option_name = 'widget_text' OR option_name = 'dashboard_widget_options';*/
UPDATE wp_options SET option_value = replace(option_value, '', '');

Learning more about this on Codex Changing The Site URL

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.