7 min read(Last Updated On: November 23, 2017)

So you want to replace text in WordPress? I did too, and in this post I’m going to show you how to get this done super-fast.

Since you’re here, I think these other posts may interest you too:

Ok, let’s get this show on the road and let me start by telling you what happened to me. Recently, I changed my business phone number and realised that I needed to replace a string of text in the content of all pages because I built the website that this change affected a long time ago and it so happens that every telephone number was on every page, and there were lots of pages!

I wasn’t about to start searching for and replacing text in all posts manually (screw that!). Not only would that be a waste of time, but there is a margin of error when doing things like this manually: you may just miss one (and that, at best, could be embarrassing, at worst, could cost you a missed lead or job).

So here was my goal:

Replacing a String of Text in The Content of All WP Pages or Posts Without Using a PHP Function [Hint: With a Find and Replace Plugin]

I had to drop a hint there, in case you thought the only way to do this was by running an SQL query. Luckily, for non-coders, there is a simpler way.

How to Search and Replace Text in WordPress: The 2 Methods

Method 1: you can find and replace text in a multiple pages or posts by running an SQL query. To do this, you need to do the following:

  1. log into your website’s cPanel
  2. search for php to filter out the phpMyAdmin icon
  3. click on your database name
  4. click on the SQL tab
  5. type in the SQL query and press the GO button

Method 2: find a plugin that replicates the above functionality. Yay! The obvious reason to do this is to stop yourself from screwing your site up by breaking your database.

Ok, let’s start with method 2, because that’s the method that I demonstrate in the video on this post.

How to do a Bulk Edit and Search and Replace Text Throughout the Entire WordPress Site

So there I was, needing to replace text in WordPress – a single string of text that appeared in the footer of all my pages. I needed to fix the content on my site, and I needed the right tool for the job.

By the way, this doesn’t happen to me these days, because I use a theme called Beaver Builder that enables me to create modules. So now, the phone number that appears all over the pages of my business site is an instance of a module. If I need to change the number, I simply change the number in the module that all the instances on all pages update. Boom.

As you probably guessed already, you can use this plugin to find and replace text in multiple posts too – not just pages.

But in that old website, every single page had a unique text string – the old number – in the footer, which meant I only had two options before I found a plugin:

  • I could either edit every single page and change the number manually
  • I could log into phpMyAdmin, drill down to my database and actually create a query to do a find and replace.

If it was a case of replacing a handful of instances, I’d have done that manually. But this site has a lot of pages, and that means a lot of text to replace.

I did actually log into phpMyAdmin and drill down to my database before it occurred to me that somebody must have created a plug-in around that very query. And lo and behold, it is so!

In the video, you’ll see me use the plugin method to change some text on my demo blog. You’ll see that I have some text in the footer that I want to change.

Here’s what I did

  • I searched for a plugin and found one called Search and Replace
  • I installed the plugin, entered the text I wanted to change and the new text
  • I ran the plugin and boom, it was all done

Actually, there was some confusion during the process, and you’ll see that in the video (feel free to laugh at my fail).

Here’s what the plugin I used looks like:

search replace plugin for replacing text in wordpress pages

Now, let me add that I have no history with this plugin and I don’t know the developer. I used it for this task and it worked fine for me. When using any plugin, do your due dilligence and just check that the plugin is up to date, compatible with your theme and has not been compromised.

Remember to Backup Your Database Before You Install & Run the Plugin

Of course, I’m going to play the ‘backup your db’ card, even if I don’t always do so (and I know you don’t either, so don’t give me a hard time!)

It’s worth mentioning that this plugin enables you to backup your database and export the SQL file, which is exactly what we want to do. You’ll see how this is done in the video.

For an extra layer of safety, backup your entire website using this method.

Now, this portion of the post is a walkthrough of what I did, which you can actually see in the video:

  • backed up my blog
  • installed and activated the plugin
  • backed up the database and downloaded the SQL file using the plugin
  • entered the text I wanted to replace using the plugin’s interface
  • entered the nex text I wanted to replace the old text with
  • ran the plugin

As I mentioned, there’s a little bit of hilarity at this point in the video because the debug text threw me off. But aside from this small thing, using a plugin to replace text in WordPress is a huge time-saver and shields you from having to mess around with your database, from writing SQL queries and potentially screwing up your website.

One nice feature this plugin has is the ability to do a dry run, which is programmer speak for ‘test run’. You can do a dry run to make sure that everything is okay and that the text you enter actually exists.

And that’s all there is to using this plugin.

The right plugins can make administering WordPress a joy. Click To Tweet

Now, if instead you want to get your hands dirty and play under the WP hood, here’s how method 1 works:

How to Run a Find & Replace in the WordPress Database With a MySQL Query via phpMyAdmin

To find the phpMyAdmin icon, when you log into cPanel, type php into the search box to filter out the right icon, like this:

search for php in cpanel

And here’s what the datases look like in the phpMyAdmin screen:

Note: I blanked out my db names because there’s always some weirdo out there that will try to target them one way or another. But essentially, you click the database that hosts your website’s data and that brings up the database structure.

From there, you click the SQL tab, type in your query and press the GO button in the bottom left:

sql query to find and replace text in WordPress

That’s the SQL query you can see there. Just replace my fictitious telephone numbers with the string of text (or numbers) that you want to find and replace in your pages or posts.

And that’s it. Now you have the 2 methods you can use to take care of replacing any old text on your WordPress site, whether it appears on all your posts or pages, your header or your footer.


This was a Hoz tutorial featured on the Youtube Channel. Make sure you CLICK TO SUBSCRIBE to catch all the video updates!

Please Share This Content
Hey, I would really appreciate it if you share this content with your friends and followers :)?


the 5 Tools I'm using to Get Traffic and Subscribers to Grow my Brand

(instant access - no waiting)