Situations like these following leave you no choice but to undergo a mass find and replace to get the problem fixed.
- Weird characters in blog entries after upgrade. After performing a wordpress upgrade, some characters will appear as “â€Â”, “â€™”, “??”
- Rename keyword1 to keyword2. You want to rename keyword1 in your entire database to keyword2, but opening the 100Mb database file with your text editor is not the smartest idea. After all, you’ll need to download a file as big as100Mb down before you can start changing, upload it before you can preview.
- You discovered a typo. You been using this phrase all the while and just realized it was wrongly spelled and want to search and replace all blog contents containing this typo.
- and so on…
Here are few methods I’ve come to know that allows one to mass find and replace in WordPress blog entries. And as always, please do a full database backup to avoid any data lost.
1. Search and Replace with WordPress Plugin
This plugin provides you with an interface in WP-Admin to search and replace text across all blog post. All you need to do is download, install the plugin and you are ready to go.
2. MySQL Search and Replace via PhpMyAdmin
This requires you to have access to your PhpMyAdmin. If you are using this method, I’m assuming you are pretty familiar with how PhpMyAdmin works; if you are not DO NOT USE THIS METHOD. Backup your database before proceed.
- Open up your database in PhpMyAdmin.
- Most of the time, you’ll want to change the contents so we’ll use “wp_post” table and “post_content” field as an example here. Click on the SQL tab.
- Here’s the quote you should paste into the textarea.
UPDATE wp_posts SET post_content = REPLACE ( post_content, 'Item to replace here', 'Replacement text here');
Make sure all text are in between the quotes ”. Double check before you hit the GO button.
So when you hit the GO button, it will go through post_content field under wp_post table, looking for all/any ‘Item to replace here‘ and replace them with ‘Replacement text here‘.