In a previous post about migrating to WP Engine I talked about having to do a search and replace across the whole database to change a temporary URL wpdude.wpengine.com to wpdude.com, to do this I used a plugin called Better Search And Replace.
https://wordpress.org/plugins/better-search-replace/
What Is Better Search And Replace
You have probably used search and replace in a word processing document where you can select  a phrase in a document and change it for something else with a bulk exercise.
Better search and replace does the same thing, but across then entire database of your WordPress site.
So I can search for the name Neil and replace it with Bob, we can choose to do this on just the content of your site, or across everything, so any mention of Neil is our posts or pages will be updated and perhaps any users called Neil will also be updated.
When You May Need To Do A Search And Replace
There have been a number of cases where I’ve needed to run a search and replace:
- When migrating my site (or clients sites)
- When moving a staging development site live
- When I’m bulk changing URLs, for example one of the products I’m an affiliate for changed the URL of their affiliate link.
- When I found corruptions with characters sets and needed to do a bulk change on the corrupt characters.
- The list goes on.
Warning
Search and replace will change your database directly, please please take a full backup first.
Video Demo
Here is a video demo to show you how to use Better Search And Replace, please note the video dies for about 15 seconds around the 4 minute mark and there is audio only.
Tables To Edit
As mentioned in the video, the post and page tables are wp_{TABLE_PREFIX}_posts and wp_{TABLE_PREFIX}_postmeta
Photo Credit: Todd Chandler via Compfight cc