How to find and replace in MySQL with phpMyAdmin | The WP Guru

How to find and replace in MySQL with phpMyAdmin | The WP Guru

For WordPress specifically, if you’d like to replace text strings inside posts and pages, then wp_posts would be your table, and field_name is the column of that table. So for wp_posts this will be post_content. You can see the field labels at the top of each column when you select a table.

To replace a URL in all posts and pages the statement would look like this:

update wp_posts set post_content = replace(
post_content, 'http://oldurl.com/',
'http://newdomain.com/subfolder/');

As soon as you hit GO, MySQL will go to work and show you a success or failure message. The above would replace all image references and links from your old domain to the new one, where WordPress is installed in a subfolder.

This entry was posted in Default and tagged , . Bookmark the permalink.