How to replace wordpress website url using database query

 

Welcome to wp-feed article, follow the below important feed for wp tips and tricks:

When many times, there is a requirement to migrate your WordPress website to a new URL. This would need you to update the old URLs in the database, including the various MySQL database tables. For smaller websites, this can be managed by manually making the changes. However, for larger websites, the volume of the site makes it impossible to update old URLs manually. Another issue is that Webmasters find it mundane and routine work to bulk change the links on the website. This is a time-consuming process as at times the number of URLs to be updated can be in the hundreds. Added to this is the chance to miss some URLs. Situations like these make it almost mandatory to look for automated solutions to do a mass search and replace of the old URLs. Let us look at some of the convenient ways to update site URLs when migrating a WordPress site.

Kindly use below query in Phpmyadmin SQL section and replace old wordpress website url  to new wordpress website url and you will get the current one url.

 

UPDATE wp_options SET option_value = replace(option_value, 'http://olddomain.com', 'http://newdomain.com') WHERE option_name = 'home' OR option_name = 'siteurl';

UPDATE wp_posts SET guid = replace(guid, 'http://olddomain.com','http://newdomain.com');

UPDATE wp_posts SET post_content = replace(post_content, 'http://olddomain.com', 'http://newdomain.com');

UPDATE wp_postmeta SET meta_value = replace(meta_value, 'http://olddomain.com', 'http://newdomain.com');

 

Thank you for reading this article. We hope this short wp feed article helped you learn more about wordpress.

Related Posts

Leave a Reply

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