Change WordPress URLs in MySQL
When a site development is ready -made with WordPress- you will have to change the URL’s on the database, the easiest and quickest way would be following these steps:
1 2 3 4 5 6 |
# Remember to change wp_ if your table prefix is different. UPDATE wp_posts SET post_content = REPLACE(post_content, 'domain.com', 'newdomain.com'); UPDATE wp_options SET option_value = replace(option_value, 'http://domain.com', 'http://newdomain.com') WHERE option_name = 'home' OR option_name = 'siteurl'; UPDATE wp_posts SET guid = replace(guid, 'http://domain.com','http://newdomain.com'); UPDATE wp_posts SET post_content = replace(post_content, 'http://domain.com', 'http://newdomain.com'); UPDATE wp_postmeta SET meta_value = replace(meta_value, 'http://domain.com', 'http://newdomain.com'); |