Bulk Replacing Content in WordPress – A New Trick

We’re currently working on a project to update the site of a client whose name and branding has changed. So there are lots of instances of their name to change in the posts and postmeta tables, as well as some inline styles left by the previous developer.

For the posts table, replacing strings in the MySQL table is usually fine, if a bit fiddly, but the postmeta table is not straightfoward, particularly when you have serialised data.

Our new trick is to use the excellent BackupBuddy plugin. If you look on the Database tab of BackupBuddy > Server Tools, down the bottom there’s a section called “Database Mass Text Replacement”. Enter your find and replace text and away you go. Obviously you need to be very, very careful, backup first, check as you go along etc, but for something like a domain or an email, it’s perfect.