Aug 15, 2013, by admin
WordPress stores the URL in his database, one of my colleague is new bie for WordPress.He has developed a new wordpress site and client has given all the data to him.After making the full site ready, he get stuck that four most important tables have URL in it, so should all the data need to re-enter by wordpress admin.
What you need to done is just replace
@old-wp-url@ and @new-wp-url@ as per your website and run these query.
UPDATE wp_options SET option_value = REPLACE (option_value, “@old-wp-url@”, “@new-wp-url@”) WHERE option_name = ‘home’ OR option_name = ‘siteurl’;
UPDATE wp_posts SET guid = REPLACE (guid, “@old-wp-url@”, “@new-wp-url@”);
UPDATE wp_posts SET post_content = REPLACE (post_content, “@old-wp-url@”, “@new-wp-url@”);
UPDATE wp_posts SET post_content = REPLACE (post_content, CONCAT(‘src=”‘, “@old-wp-url@”), CONCAT(‘src=”‘, “@new-wp-url@”));
UPDATE wp_posts SET guid = REPLACE (guid, “@old-wp-url@”, “@new-wp-url@”) WHERE post_type = ‘attachment’;
UPDATE wp_postmeta SET meta_value = REPLACE (meta_value, “@old-wp-url@”, “@new-wp-url@”);
UPDATE wp_links SET link_url= REPLACE (link_url, “@old-wp-url@”, “@new-wp-url@”);
UPDATE wp_links SET link_image = REPLACE (link_image, “@old-wp-url@”, “@new-wp-url@”);