Sometimes for some reason, we need to change WordPress URLs , but if there are too many, we need a batch processing method.
Step 1 - Go To Your phpMyAdmin And Select Database Then Head To SQL Tab
Step 2 - Enter The Following SQL Query
UPDATE wp_posts SET post_content = replace(post_content, 'https://oldurl.com','https://newurl.com');
or
UPDATE wp_options SET option_value = replace(option_value, 'oldurl.com', 'newurl.com') WHERE option_name = 'home' OR option_name = 'siteurl';UPDATE wp_posts SET guid = replace(guid, 'oldurl.com','newurl.com');UPDATE wp_posts SET post_content = replace(post_content, 'oldurl.com', 'newurl.com');
UPDATE wp_postmeta SET meta_value = replace(meta_value,'oldurl.com','newurl.com');
Replace oldurl.com with your current WordPress address and newurl.com with your new WordPress address.
Step 3 - Press Go
Step 4 - Verify The Changes
Open the wp_options table and check the option_value of siteurl and home. You should see your new URL.
* Conclusion
In this tutorial, We just learned how to change WordPress URLs in the MySQL database using phpMyAdmin. I hope this post would help anyone who's searching change WordPress URLs in the MySQL database. Feel free to leave a comment if you have any question.
0 Comments