How to Search and Replace Text in WordPress

Ogi Djuraskovic
Updated: October 4th, 2023
7 min read
FirstSiteGuide is supported by our readers. When you purchase via links on our site we may earn a commission. Read More
How to Search and Replace Text in WordPress

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 that can save you from manually deleting hundreds, if not thousands of typographical errors.

Search and replace any text in WordPress and save time when editing posts

Yes, PHP and MySQL are powerful tools that 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.

Search and replace text in the 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 the WordPress editor. Since you’re reading this, you probably discovered the downside of WP editor – it doesn’t come with such a feature. As we already told you in the introduction, we’re about to show you a neat plugin for the job

TinyMCE Advanced


TinyMCE Advanced find and replace

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:

  1. Navigate to Settings -> TinyMCE Advanced
  2. Find the list of unused buttons and look for Find and Replace
  3. Drag the button to the editor menu
  4. 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?

  1. Look for Find and Replace button on top of the editor
  2. Fill in the text you want to replace
  3. Write in the text to replace it with
  4. Check if you want to match case and search for entire words
  5. 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 grammar mistake for days. 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


Better Search Replace plugin for WordPress

As promised, here’s another free plugin that will save you. Since you want to replace something throughout the entire WordPress system, 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.

  1. Navigate to Tools -> Better Search Replace
  2. Type in the text you are searching for
  3. Type in the text which will replace it
  4. 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 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 it 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 that 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.

Replace any word on the entire WordPress website

Once you have accumulated hundreds or even thousands of different posts and pages which are spread across different categories, changes to the entire database become more and more difficult each day. If you have ever wanted to replace just one word or the entire phrase in each and every post, page, title, comment, etc. you ended up with a headache because this task would require too much time or technical knowledge from you.

Since you’re already using a WordPress blogging platform, renowned for its extensions (plugins) which allow you to do practically anything, this problem stops being a problem at all. Now you can install a free plugin and manage word changes in just a few clicks.

Word Replacer


Word Replacer for WordPress

The plugin we’re talking about is known as Word Replacer and you can install it for free by downloading the plugin from the WordPress repository website or you can find the plugin by searching it from your WordPress:

  1. Navigate to Plugins -> Add New
  2. Search for “Word Replacer”
  3. Install and activate the plugin
  4. Open settings page where you can replace words with a single click

If you have ever used “Search and Replace” in Microsoft Word or a similar text processor application, you will be quite familiar with this plugin. Its user-friendly interface allows you to quickly enter a word or the entire phrase which you want to replace, choose another one which will be added instead of the original word/phrase and you can decide where those changes will occur.

Word Replacer allows you to replace words in posts, pages, comments, titles, and even bbPress forum pages since version 0.3.

A good thing about this plugin is that you can, for example, write a list of profanity words that you can easily censor in comments and your forum pages or you can change that one phrase which you may have used incorrectly for last few months or so. And you can do all that by typing a word/phrase only once in plugin’s settings and Word Replacer will do its magic in a second.

Another great example of what the plugin is capable of is JavaScript ads. If you have used an ad placeholder on your website, you can now easily tell Word Replacer to search for that placeholder and replace it with the actual JavaScript code which will show the desired advertisement. Once you decide to change the ad, simply change the code in the settings without having to worry about where the code is inserted. Quite a nice feature for such a simple plugin.

Word Replacer really is a powerful plugin that allows you to manage your entire WordPress content from one place. Even if you’re not planning on using it all the time, the plugin can really help you change those mistakes and censor those bad words written in comments or your forum pages. Since it’s free, you don’t have to worry about losing any money on it – install the plugin and give it a go. Of course, don’t forget to create a backup of your site before replacing any words, as you never know when the error might pop up.

Linking words or entire phrases in WordPress couldn’t be easier. While writing an article, all you have to do is select a word/phrase and click on the link button where you can paste the link destination. If you know basic HTML, you can also create links directly from a Text editor by writing your own code if necessary.

WordPress links

While linking word by word is easy and can be quite fun if you’re slowly working on a new post, what if you wanted to link a specific word/phrase throughout your entire posts/pages collection?

If you’ve just started with your WP powered website and have only a few articles to deal with, it wouldn’t be a problem linking them all manually. But what if you have decided to link a word in all articles and you have hundreds of them?

Create links from specific words:

Whether you want to link a specific website name to its own URL or you have started your referral program and want to link every computer-related word to your referral website which sells computer equipment, this function will help you insert a link tag within the word/phrase of choice.

  1. Open functions.php
  2. Copy and paste the following function:
function link_words( $text ) {
$replace = array(
'google' =>'<a href="">Google</a>',
'computer' => 
'<a href="">computer</a>',
'keyboard' => 
'<a href="">
buy keyboard here</a>'
$text = str_replace( array_keys($replace), 
$replace, $text );
return $text;
add_filter( 'the_content', 'link_words' );
add_filter( 'the_excerpt', 'link_words' );

  1. Change keywords and links in an array
  2. Save changes

As you can see from examples in the code, it is possible to replace any word or any phrase found in your articles. Also, it is possible to replace the word/phrase itself and change the link entirely.

While you can simply add the link to the word “computer”, you could add the link and change the word “computer” into “computer system” or anything you like.

While this function will help you catch up with all those left behind articles, it is pretty much basic as it gets. If you want more control over links, especially if you’re working with referrals, it would be a smarter choice to go with one of the specialized plugins.

Since you’re already working with links, you might be interested in instructing WordPress on opening all external links in new tabs or maybe even linking posts and pages to an external URL.


If you have just started a WordPress blog, searching and replacing words might seem impossible. But if you take a few minutes of your time to go through this guide, you will solve the problem, and searching and replacing text in WordPress will seem like child’s play.

6 comments on “How to Search and Replace Text in WordPress”

  1. FactsFixer

    Very useful information, it helped me a lot. Thank you

  2. Min Genaa

    Dear Ogi, Thanks for saving me so much time.
    I had trouble replacing 2021 with 2022 in my blog posts.

    I initially tried to do it manually but eventually gave up because there were too many. Thank you for sharing this. You saved my life. It means so much to me. Lol!

  3. Manoj

    Very informative article. I use TinyMCE from the very beginning when I started blogging for post editor customization. It is a great plugin to manage, beautify texts with find and replace & other similar features. I am not familiar with other mentioned tools but they seem interesting.

    Thanks for the writing. It is useful for WordPress bloggers and other users on the platform.

    All the best,

  4. Maxwell

    Helpful article with complete information and easy to understand.

Leave a Reply

Your email address will not be published. Required fields are marked *

Send this to a friend