Recently we’ve helped a few of our clients move wordpress installations between domain names. This is a fairly easy process except that links that were made inside of posts, such as links to other posts, pages and images hosted on the site are likely to break. Also, if you change permalinks around a lot or move stuff around inside of your wordpress “uploads” folder, you might find lots of broken links.

You’ll need access to run SQL statements on your database. For most people, using phpmyadmin is the easiest way to accomplish this. phpmyadmin is usually available on the control panel backend that your webhost provides.

Before you do anything, its a good idea to backup your entire database. If you are using phpmyadmin, you can do this by selecting your wordpress database and going to “export”. Select “Save as File” and “zipped” or “gzipped”.

Once you are ready to do the find replace, you can enter your SQL statements in the “SQL” tab of phpmyadmin. Here is the syntax for a find replace in mySQL:

update TABLE_NAME set FIELD_NAME =
replace(FIELD_NAME, 'find this string', 'replace found string with this string');

In wordpress, to search the content of all posts and pages, you would use the table wp_posts and the field post_content:

update wp_posts set post_content =
replace(post_content, 'find this string', 'replace found string with this string');

Source: http://blinktag.com/how-to-find-replace-in-mysql-for-wordpress-permalinks-that-have-changed/

 

UPDATE!!!

update wp_posts set guid =
replace(guid, 'find this string', 'replace found string with this string');

and

update wp_options set option_value =
replace(option_value, 'find this string', 'replace found string with this string');

This page has been readed 1211 times

Leave a Reply

Your email address will not be published. Required fields are marked *