Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
25 Million+
Websites using our plugins
Years of WordPress experience
WordPress tutorials
by experts

How to Do Search and Replace in WordPress With a Plugin

Editorial Note: We earn a commission from partner links on WPBeginner. Commissions do not affect our editors' opinions or evaluations. Learn more about Editorial Process.

Managing a WordPress site often involves making changes across many posts and pages. One common task is searching for specific content and replacing it with something new.

We know firsthand how time-consuming it can be to search for and replace content manually. If you aren’t careful, it can also cause mistakes.

That’s why we looked for easier ways to search and replace content on your WordPress site. These methods will allow you to make bulk changes quickly and efficiently.

Let’s examine the reasons why you might need to search and replace WordPress content and how to do it effectively.

Quickly performing search and replace in WordPress using a plugin

When You May Need Search and Replace (Use Cases)

There are many situations where you might need to search and replace content on your WordPress site.

Here are some common use cases:

  • Changing URLs: When you move a WordPress site to a new domain or switch to HTTPS, you will need to update all the URLs used across your website to point to the new domain name or the HTTPS URL.
  • Updating Old Content: If you have outdated information, then you can quickly update it across multiple posts. For instance, product pricing, stats, and figures, and more.
  • Fixing Typos: Sometimes, you will find a repeated typo or error in your content. Using search and replace can fix it all at once.
  • Replacing Shortcodes: If you are using a WordPress plugin that uses shortcodes, then switching the plugin could break those shortcodes. A quick search and replace can help you fix that.
  • Updating Brand Names or Phrases: When your business rebrands, you can update the brand name across your site with ease. Similarly, if you have mentioned a company many times on your blog and they change their name, you will be able to easily update and use the new brand name.
  • Replacing an Image Used Across Multiple Locations: With just a click, you can quickly replace an outdated image anywhere on your site with a new one.

Using a search-and-replace plugin saves time and ensures consistency. Now, let’s prepare for the search-and-replace process by creating a backup.

Preparing for Search and Replace

Before making any changes to your WordPress database, it’s crucial to create a backup. This ensures you can restore your site if anything goes wrong.

We recommend using Duplicator. It is the best WordPress backup plugin for creating on-demand backups, and more importantly, it makes it easy to restore your site using those backups.


Note: A free version of Duplicator is also available. It is limited in features but would be enough to create a database backup and store it on your computer.

For detailed instructions and alternative backup options, see our beginner’s guide on creating WordPress backups.

Having a backup gives you peace of mind and ensures your data is safe. Now, you can safely perform search and replace tasks on your website.

We will cover 2 methods in this tutorial, and you can use the quick links below to jump to the one you want to use:

For this method, we will show you how to use the Search & Replace Everything plugin.

Created by the team behind WPCode, which is the best WordPress code snippets plugin, Search & Replace Everything is the easiest way to search and replace content on your WordPress site.

It can be used for all kinds of content, including:

  • Text
  • Images
  • Content within specific database tables

First, you need to install and activate the Search & Replace Everything plugin. If you need help, then please see our tutorial on how to install WordPress plugins.

Note: There is also a free version of Search & Replace Everything. However, it has fewer features, such as not letting you undo changes or view history.

Upon activation, you need to go to the Tools » WP Search & Replace page to start using the plugin.

Searching And Replacing Content

Under the Search & Replace tab, simply enter the content you want to search for and then add the content you want to replace it with.

Search & Replace Content

By default, all searches are case-sensitive. This means if you search for “WordPress,” it will not match “wordpress,” “WordPress,” or “WORDPRESS.”

If you want your search to match all instances, regardless of case, then you can toggle the “Case Insensitive” switch below.

If you know which database tables to look into, then you can select those down below.

For example, if you want to search and replace some text in your posts, then you may want to select the posts table. This will make your search faster and more precise.

You can also select multiple tables or all tables. The plugin is optimized for performance, so it will run the search efficiently without slowing down your website.

Select Tables

Bonus Tip 💡: Learn more about WordPress database management and what each table does in WordPress.

Finally, click on the ‘Preview Search & Replace’ button.

The plugin will open a popup in which you will see a preview of items that match your search term and how they would look when replaced with the term you provided.

Preview changes

If everything looks good, then click on the ‘Replace All’ button to apply your changes.

The plugin will then show a warning message reminding you to create a backup.

Backup warning

Since you have already created the backup, you can click on ‘Yes’ to apply your changes.

Track And Undo Changes

If you are using the Pro version of the plugin, then you can easily view past changes you made and undo them if needed.

Switch to the ‘History’ tab on the plugin’s settings page, and you will see a list of your search and replace operations.

Then, simply click the ‘Undo’ button if you want to revert the changes.

Undo search and replace changes

Replace Images in WordPress

Search & Replace Everything doesn’t just search and replace text. It can also replace an image.

This can be handy in situations where you have used the same image across multiple posts, pages, and other locations on your website.

Replacing the image using Search & Replace Everything will change the image in all those locations.

Just switch to the ‘Replace Image’ tab under the plugin settings and locate the image you want to change.

Replace image

Take the mouse over to the image and then click on the ‘Replace’ button.

Next, you will need to upload the image you want to use as the replacement. Click on the ‘Choose a file…’ button to upload.

Replacing an image

The plugin will show you a preview of your replacement image next to the old one.

Tip 💡: For better results, it is recommended to use a replacement image of the same size (width and height dimensions).

Finally, you need to click on the ‘Replace Source File’ button to save your changes.

The plugin will now replace the old image with your new image. You can now visit your website to ensure that the new image is being displayed.

Tip 💡: If you are still seeing the old image, try clearing the WordPress cache.

Method 2: Using Better Search Replace Plugin

For this method, we will be using the Better Search Replace plugin. It is a free plugin with slightly different options than Search & Replace Everything.

The first step is to install and activate the Better Search Replace plugin. For details, see our tutorial on installing a WordPress plugin.

Once you have activated the plugin, go to the Tools » Better Search Replace page to use the plugin.

Better Search and Replace settings

Simply add the text string you want to search for and then add the text you want to replace it with.

After that, you need to select the tables you want to search in. For example, if you want to search and replace some text in your posts, then you may want to select the posts table. You can also select multiple tables if you wish.

By default, all searches are case-sensitive. This means that if you search for “WordPress,” it will not match “WordPress,” “WordPress,” or “WORDPRESS.”

If you want your search to match all those strings as well, then you can make your search case-insensitive.

Additional search settings

Optionally, check the ‘Run as dry run’ option.

This will allow the plugin to run a search and show you how many tables and cells will be affected.

Click on the ‘Run Search/Replace’ button to continue.

Dry run results

If you chose the ‘Run as dry run’ option, then the plugin will show you details of affected database tables and cells.

You will then have to run the search again. This time, you will need to uncheck the ‘Run as dry run’ option so that your changes are written in the database.

If you didn’t choose the dry run option, then the plugin will just go ahead and make those changes.

Changes made successfully


You may see the white screen or run into timeouts while performing a search and replace.

If this happens, then you need to click on the ‘Settings’ tab on the plugin page.

Decrease page size

You will notice the ‘Max Page Size’ option. Now, try decreasing the page size to avoid timeouts and a white screen.

That’s all. We hope this article helped you learn how to easily perform search and replace tasks in WordPress for bulk changes. You may also want to see our tutorial on how to clean up your WordPress database for improved performance or how to bulk delete WordPress posts.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. See how WPBeginner is funded, why it matters, and how you can support us. Here's our editorial process.

Editorial Staff

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

The Ultimate WordPress Toolkit

Get FREE access to our toolkit - a collection of WordPress related products and resources that every professional should have!

Reader Interactions

25 CommentsLeave a Reply

  1. Syed Balkhi says

    Hey WPBeginner readers,
    Did you know you can win exciting prizes by commenting on WPBeginner?
    Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
    You can get more details about the contest from here.
    Start sharing your thoughts below to stand a chance to win!

  2. Dayo Olobayo says

    Upgrading to the premium version of this plugin was worth every penny. The advanced features like case-sensitivity and selective table targeting saved me so much time. Definitely a must-have tool in my WordPress toolkit.

    • WPBeginner Support says

      The plugin does have the ability to search what was added through other plugins, you would mainly want to make ensure you search the correct tables.


  3. Paul G says

    Thanks, this mostly worked for me but didn’t quite change all of the image links.

    The rest I could easily change myself by editing the custom modules.

  4. Karol says

    Changed a website from http to https via cpanel; green lock did not appear and “connection is not secure” warning was present. This plugin worked great for me. The only difference I did was that I left the checkmark off “Case Insensitive?”.

    Every site can be different with it’s own hurdles to jump through but the dry run seemed to look okay without any errors so I ran with it. Green lock appeared right away for the site. Plugin worked for me. I hope it continues to work with other sites.

    My only question now is … Do I leave the Better Search Replace plugin installed and activated or do I uninstall it now that I’m done?

    • WPBeginner Support says

      That would be a personal preference question but you should be able to remove the plugin without worry :)


  5. Mandy says


    My site is having issues showing images lately, and my host said that it’s because the paths are wrong. They recommended this plug in, but my problem is that I am not sure what I am searching and replacing. Here’s why:

    When I insert an image in “visual” mode within a post, it shows up. They all do.
    Then when I preview or publish, some images don’t show up. What I am noticing lately is that instead of the code showing them as “image.jpg”, they now have the image size you choose in the path – “image-300×188.jpg” (this happens to be the medium size for this particular image). Why is it putting the pixel dimensions? If none of the images worked, I could say yes, the paths are incorrect, but some images DO work! I am officially bamboozled. It seems so random.



  6. Ashraf Ali says

    I am switching from http to https now the common problem faced is broken css, I am wondering if could use this plugin to replace https:// to just //

    So that all contents are delivered over https


  7. Drew says

    I had a program enter structured data that is all different. I want to remove everything between and including this : ———————-

    How would I do that?

    • WPBeginner Support says

      Hi Drew,

      We are not sure we completely understand your issue. However, we are guessing that you had a plugin to add structured data and now you want to remove the structured data from your WordPress posts and pages? If this is the case, then you can simply uninstall the plugin.


  8. Sueli says

    Great plugin!

    I have a question.
    Can I use a wildcard?

    I am trying to remove numbers added after an image file. They are different (both the numbers and their length). The stop point would be the (“).

    Some examples of what I want to replace with (jpg”)

    Is it possible with this plugin?


  9. David says

    I download “Better Search & Replace. Once it found entries, it doesn’t show me unless I buy premium addon.

    So instead I ditched that and downloaded “Search & Replace”. It took me only two minutes to replace 100 entries.

  10. Ralpheal says

    Wow thanks so much, this is truly a luxury. Going to save me a lot of time, as I was considering changing a phone number on 1oo’s of blog posts.

    Thanks so much, :)


  11. Mike says

    This plugin did not work for me. I backed up the database, then unchecked “Dry Run”. It messed up things all over the site and there was no way to undo the changes.

    I even tried to restore the database backup I created with it before making changes and that didn’t work. Don’t use this unless you’re prepared to do an entire site restoration.

  12. vikas kumar says

    help me out from pagination error i did which you show in video but i didn’t get result
    i am using macbook air in this your given shortcode not work properly

  13. Marko Tiosavljevic says

    yes, but this plugin is practically useless when it comes to migrations.

    When you migrate website from domain . com to another . com you need to change

    you need to connect to database for changing url or you need to insert it in wp_config as url

    i am working on external app wp safe mode that is solving this problems in best way.

  14. Nico says

    Hi, it seems that this plugin is no longer available in WordPress Plugin Directory. Which alternative plugin do you recommend?

    With kind regars,

  15. Brian says

    Does this take into account serialize data or will it break plugins that use serialized metadata? I know of a few plugins that do this for migration purposes. If it doesn’t it could cause more problems than it solves.

Leave A Reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.