The following was originally published on WordCast and authored by Lorelle VanFossen. It is reprinted here as a reference guide.
- You’ve moved your WordPress installation from one server to another.
- You’ve changed domain names.
- You’ve moved images around on your server and now they don’t load.
- You’ve changed your WordPress installation and now images show blank boxes on your posts.
- You’ve changed your email address.
- An author has changed their name or URL.
- You’ve been asked to remove all of someone’s blog comments.
- You’ve turned things off during development and it’s time to turn them back on.
- You’ve gotten smart and changed your WordPress URL and installation from
- You’ve realized that you’ve been misspelling “separate as “seperate” and you now need to fix all the missed spellings.
- You’ve realized that WP as an acronym isn’t as SEO friendly as you thought and decide to change them all to WordPress.
These are just a few of the reasons why you need to know how to do a search and replace in the WordPress MySQL database. Some people choose to export their entire WordPress site’s data and edit it in a text editor, but for those with hundreds or thousands of posts, it’s easier to do it in the MySQL database.
Playing with your WordPress MySQL database is not for the weak of heart and faint of code. There is much to fear. The worse case scenario is that you blow up your site. The best scenario is that you fix some problems that have been plaguing you. I’ve some warnings below, but trust that even someone with little coding experience can do this, if you are very, very careful and take precautions.
The following search and replace and delete WordPress-related queries for MySQL are included:
- The Process of Searching and Replacing in the MySQL Database
- Search and Replace Blog Content
- When You’re Not Sure of the Unique Value to Search and Replace
- How to Search and Replace Domain Names
- How to Search and Replace Image Location Issues
- How to Search and Replace Ad or Affiliate Links
- How to Search and Replace Nofollows
- How to Search and Replace Administrator Username, Passwords, and More
- Changing a Post Author’s Name or Information
- Cleaning Up Your Spellings, Cusses and Ps
- How to Search and Replace Within the WordPress Custom Fields
- How to Change WordPress Table Prefixes
- How to Search and Remove Blog Comments
- Overloaded with Comment Spam?
- How to Enable Functionality in WordPress from Within the Database
- Create a Mailing List of Commenters
- Cleaning Out Unused Tables from WordPress Plugins and Add-ons
- More Resources and Tips for Search and Replace in the WordPress Database