In MyKinsta, you can find a handy tool for doing a search and replace on your site’s content without having to install a plugin, install a script, or use the command line.

Note: When a search and replace is performed, we automatically create a system-generated backup in MyKinsta that can be restored if needed (Sites > sitename > Backups > System generated).

How To Use the Search and Replace Tool in MyKinsta

To locate this tool, log in to MyKinsta, click on Sites in the left sidebar, and click on the name of the website you want to run the search and replace on:

Click on the Tools tab, look for or scroll to the Search and replace section, and click on the Search and replace button:

Search and replace button in MyKinsta.
Search and replace button in MyKinsta.

There are a number of different operations you can use this tool for. In this example, we’ll change some URLs that use “http” to ones using “https” in the database.

In the search field, enter the value you want to look for in the database, and hit Search. The search and replace tool will display the number of occurrences for the given string:

Using the search field in the search and replace tool.
Using the search field in the search and replace tool.

Note: The tool is case sensitive, so searching for “WordPress” is different from searching for “wordpress.”

To search and replace, check the Replace box and enter the new text, URL, or other value in the Replace with field:

Searching for old text and replacing it with new text in the search and replace tool.
Searching for old text and replacing it with new text in the search and replace tool.

We recommend leaving the Clear cache when ready box checked to automatically purge your site’s cache after the search and replace process. That way, visitors will see the updated version of your website right away. Then, click the Replace button.

After the WordPress search and replace is complete, you’ll see a confirmation dialog showing the number of replacements that were processed. When you’re done, click Cancel to exit the search and replace tool. That’s it!

Tips and Examples

Now that we know how to use the search and replace tool, let’s go over some tips and examples.

Tips

  • As also noted above, searching is case sensitive, so searching for “WordPress” is different from searching for “wordpress.”
  • When replacing URLs, best practice is to either include the full URL, including the protocol (http:// or https://), or at least the leading forward slash before the domain (e.g. /example.com). This prevents unintentionally changing the domain of email addresses.
  • You can search and replace entire sentences, including spaces and punctuation.
  • For custom site configurations like Bedrock, or in the case of a plugin or theme error, the search and replace tool may not be able to complete. For these situations, we recommend trying the WP-CLI search-replace command with the --skip-plugins and/or --skip-themes flags as needed.
  • Some plugins and/or themes may have their own search and replace tools that will need to be used due to the way they save information in the database. A few popular examples are:
  • If your plugin or theme has its own built-in cache, you’ll need to clear that cache after doing a search and replace. Some popular examples are:
  • Speaking of cache, if your search and replace doesn’t seem to have updated your site, you may have any additional caching besides the server cache handled by Kinsta. You’ll want to make sure you clear all cache in this order:
    • Clear any built-in theme or plugin cache.
    • Clear site/server cache (yes, clear this again if you cleared any theme or plugin cache).
    • Clear browser cache.

Examples

Be sure to replace the example domains as needed.

Replace www.www.domain.com with www.domain.com

This can happen if you already had some instances of www.domain.com in your site’s content, then switched the primary domain from domain.com to www.domain.com in MyKinsta, and checked the box to Run search and replace after change.

Search: /www.www.domain.com

Replace with: /www.domain.com

Replace email address domain only

Maybe you want to use a shorter version of your domain for email sending and receiving or, for some other reason, need to replace the domain of email addresses only without affecting any other instances of the domain (e.g. in image URLs or links).

Search: @olddomain.com

Replace with: @newdomain.com

Replace http URLs with https URLs

While you can redirect HTTP to HTTPS in MyKinsta for your primary domain, you may want to update all URLs in your content as well, or there may be other URLs besides the primary domain you want to change.

Search: http://domain.com

Replace with: https://domain.com

Replace custom domain with temporary domain

If you manually migrate your site yourself and want to test your site with your Kinsta temporary URL, here’s how you can do that without affecting any email addresses in your content. Note the leading forward slash (/) and be sure also to replace sitename.kinsta.cloud with your site’s Kinsta temporary URL.

Search: /domain.com

Replace: /sitename.kinsta.cloud