WordPress old url or homeurl or home_url or siteurl or site_url error solution update into database with sql query and change url

Just execute this query and solve error and change the site and home url.


UPDATE wp_options SET option_value = replace(option_value, ‘http://oldurl.com’, ‘http://newurl.com’) WHERE option_name = ‘home’ OR option_name = ‘siteurl’;

UPDATE wp_posts SET guid = replace(guid, ‘http://oldurl.com’, ‘http://newurl.com’);

UPDATE wp_posts SET post_content = replace(post_content, ‘http://oldurl.com’, ‘http://newurl.com’);

UPDATE wp_postmeta SET meta_value = replace(meta_value,’http://oldurl.com’, ‘http://newurl.com’);

Share on FacebookShare on Google+Tweet about this on Twitter