MySQL for Updating WordPress Post URLs

Sometimes you’ll need to update post and page urls when going from a development environment to production, or more simply when going from one domain to the next. If you have many (10s to 100s), and you will have that if the WP snapshots have been run, then you’ll want to update them all easily. You can do this with MySQL:

UPDATE wp_posts SET guid = REPLACE(guid,"","");
UPDATE wp_posts SET post_content = REPLACE(post_content,"","");
UPDATE wp_options SET option_value = REPLACE(option_value,"","");
UPDATE wp_links SET link_url = REPLACE(link_url,"","");
UPDATE wp_postmeta SET meta_value = REPLACE(meta_value,"","");

That’s it. You can update your WordPress post and page url values with just a little html.

Here’s a resource from WordPress to help with a WordPress move:

Post written by Ed Reckers

Founder and lead web development consultant at Red Bridge Internet : San Francisco WordPress Developers and Consultants.

2 Responses to “MySQL for Updating WordPress Post URLs”

  1. subha

    thank you

Leave a Reply