If you have ever moved your WordPress site to a new host or a new domain, you may have encountered some issues with your URLs. For example, your images may not load properly, or your links may point to the old site. This is because WordPress stores the site URL and the home URL in the database, and they need to be updated when you change your site location.
There are several ways to update your WordPress URLs in the database, but one of the easiest and most reliable methods is to use a SQL query. A SQL query is a command that you can run on your database to perform a specific task, such as changing or deleting data.
In this blog post, I will show you how to use a SQL query to change and update your WordPress URLs in the database when you move your site to a new host. This method works for any type of WordPress site, whether it is a single site or a multisite network.
UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldurl', 'http://www.newurl') WHERE option_name = 'home' OR option_name = 'siteurl'; UPDATE wp_posts SET guid = replace(guid, 'http://www.oldurl','http://www.newurl'); UPDATE wp_posts SET post_content = replace(post_content, 'http://www.oldurl', 'http://www.newurl'); UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://www.oldurl','http://www.newurl');