mySql search and replace within a field.

When moving wordpress sites from one domain to another, it’s common to have hard coded urls in the database of the old web site.  To update the majority of the posts, you can use the following sql statement to update the post urls.  You may also need to run the statement on the guid foild as well.

UPDATE wp_posts SET post_content = REPLACE(post_content, ‘staging.server.com’, ‘www.productionserver.com’);

 

0
Tags :