Have you ever realized that you had made a mistake while writing a WordPress post just to find out that there’s no easy way to search and replace that typo throughout the entire post? What if you’ve been writing a wrong word, phrase or link for the last few months? Unfortunately, WordPress doesn’t allow you to search and replace text in an easy way, but we’re about to show you free plugins which can save you from manually deleting hundreds, if not thousands of typographical errors.
Yes, PHP and MySQL are powerful tools which can solve these kinds of things with just a few lines of code or queries. But not all of us are coders nor comfortable messing with code. So we’ll just skip that and show you the easy way of handling search and replace in WordPress. If you know how to handle code, we suggest that you also check out how to automatically create links from keywords in all articles and forbid specific words to be used in comments.
Search and replace text in post editor
Just like in many text processors you might have been using (like Microsoft Word, for example), you might want to search and replace text in WordPress editor. Since you’re reading this, you probably discovered the downside of WP editor – it doesn’t come with such feature. As we already told you in the introduction, we’re about to show you a neat plugin for the job
TinyMCE Advanced is an awesome plugin which allows you to add, remove, and rearrange buttons found in WordPress’ Visual Editor. As you might have guessed, one of the great features this plugin offers is the search and replace function.
If you want to be able to quickly find text in the post you’re just writing and replace it with another text, you can set up the plugin in a matter of minutes. Just install TinyMCE Advanced, activate it and you will get to add your button:
- Navigate to Settings -> TinyMCE Advanced
- Find the list of unused buttons and look for Find and Replace
- Drag the button to the editor menu
- Save changes
After you complete these four steps, your new feature gets ready for usage. To start using search and replace in WordPress, you should start writing a new post (or edit an older one) and make sure that you are viewing the post in the Visual Editor. Ready to replace words?
- Look for Find and Replace button on top of the editor
- Fill in text you want to replace
- Write in text to replace it with
- Check if you want to match case and search for entire words
- Find, replace or replace all
That’s it! Instead of manually going through thousands of words you may have written in that particular post, this fantastic plugin will do the job for you in a second.
It was easy, wasn’t it? But what if you want to do the same for all of your posts and pages? Maybe you want to search and replace things in comments or taxonomies? If that’s the case, keep on reading because you will need another plugin.
Search and replace text throughout the entire WordPress
Sometimes, you realize that you’ve been making a mistake for days, months or hope not, for years. Maybe you have been misspelling something, maybe a service you were mentioning changed its name, or maybe you need to update a URL. Don’t worry; you can change that easily, and you won’t have to run MySQL queries to fix the problem.
Better Search Replace
As promised, here’s another free plugin which will save you. Since you want to replace something throughout the entire WP installation, this plugin will allow you to work with databases – without having to open or modify a database by hand.
The installation of the plugin is standard and quick. After you activate Better Search Replace plugin, the fun can begin.
Before you do any changes, please create a backup of your database.
- Navigate to Tools -> Better Search Replace
- Type in text you are searching for
- Type in text which will replace it
- Select tables which will be affected by the plugin
Before you do the actual changes to your database, we suggest that you leave the Run as Dry Run option checked. This option will tell the plugin to do the necessary search, but it won’t do any changes. By using Dry Run, you get to see how many tables and cells in a database will be affected and you can think twice before making an actual change.
Once you’re ready to replace text, uncheck the Dry Run option and enjoy what this amazing plugin will do for you.
Be careful when selecting tables from the step #4. If you want to make changes just to your posts, select only wp_posts table.
Depending on your database, search and replace function might take some time to do its job. Before you start panicking, you should know that it is okay to get timeouts and white screens while running search and replace with the plugin. In that case, just navigate to Tools -> Better Search Replace -> Settings, and decrease the Max Page Size value.
If you install these two free plugins, you can relax and start working on your new article worry-free. Whether you have to search and replace text from just one article, or you need to do that for all of your posts, comments, etc. you should know that TinyMCE Advanced and Better Search Replace plugins got you covered.
Instead of replacing them, did you know that you can easily write a list of words which won’t be allowed in post titles?
Have you tried the plugins? How do you like them? Do you prefer replacing text manually by running queries or do you maybe use another plugin for the job? Let us know in the comments below.