WordPress Update query for replacing local to online site links all

Query 1:

Change site Address and site link address homepage :

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

This query can update your site url and home page link of the site. WordPress Address (URL) and Site Address (URL).

Query 2:

Update the guide url path of page and posts. So we run the following SQL:

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

It should change the all (guid) guide path of post and page content of WP_POSTS table.


Query 3:

Update  blog posts or pages with absolute URLs, these links will point to wrong locations after you move the blog location. So we run the following SQL to fix this issue:

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

All the media files images,video,audio internal links will be changed to new site path url.