Posted By

johnandrewsroot on 02/04/10


Tagged

url mysql path wordpress change


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

hussong


Wordpress updating URL paths after address change


 / Published in: MySQL
 

If the official codex approach (http://codex.wordpress.org/ChangingTheSite_URL) is causing you problems, give this a try. Be sure to change the constant declarations and modify table names as necessary for your instance. Confirmed working with WP v3.4.

  1. SET @current_path='site.dev.example.com',
  2. @new_path='site.stage.example.com';
  3.  
  4. UPDATE wp_posts SET post_content = REPLACE(post_content, @current_path, @new_path);
  5. UPDATE wp_posts SET guid = REPLACE(guid, @current_path, @new_path);
  6. UPDATE wp_options SET option_value = REPLACE(option_value, @current_path, @new_path);
  7. UPDATE wp_postmeta SET meta_value = REPLACE(meta_value, @current_path, @new_path);

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: blitz on July 24, 2012

There is no such thing as termsmeta or meta_value for it in Wordpress. Not sure what the last line is for, or if it is a typo. The rest is a nice compact to update a migration if confident with MySQL :-)

Posted By: blitz on July 24, 2012

There is no such thing as termsmeta or meta_value for it in Wordpress. Not sure what the last line is for, or if it is a typo. The rest is a nice compact to update a migration if confident with MySQL :-)

Posted By: blitz on July 24, 2012

There is no such thing as termsmeta or meta_value for it in Wordpress. Not sure what the last line is for, or if it is a typo. The rest is a nice compact to update a migration if confident with MySQL :-)

Posted By: blitz on July 24, 2012

There is no such thing as termsmeta or meta_value for it in Wordpress. Not sure what the last line is for, or if it is a typo. The rest is a nice compact to update a migration if confident with MySQL :-)

Posted By: blitz on July 24, 2012

There is no such thing as termsmeta or meta_value for it in Wordpress. Not sure what the last line is for, or if it is a typo. The rest is a nice compact to update a migration if confident with MySQL :-)

Posted By: blitz on July 24, 2012

There is no such thing as termsmeta or meta_value for it in Wordpress. Not sure what the last line is for, or if it is a typo. The rest is a nice compact to update a migration if confident with MySQL :-)

Posted By: blitz on July 24, 2012

I think there is a technical issue with this page and duplicating comments…

Posted By: johnandrewsroot on November 11, 2012

Thanks for your comment. This was some WP versions ago (version 2.9) so syntax has since changed.

You need to login to post a comment.