Do you want to search and replace a term in the database? data of your WordPress blog ? Whether you want to find and replace specific text, URL, or image, you can easily do so using the WordPress search and replace plugin or with a simple SQL query.

In this tutorial, we'll show you how to find and replace text in your database. data WordPress.

When will you need to make such a change on your database?

Suppose you have added specific text or URL to a number of your articles. You do not remember exactly where you added these links, and want to delete them (or simply replace).

That's right, you can manually search your site and edit each item one by one. But it will take time and you can even pass some results.

Using a single command to search and replace automatically, will do the same thing, but this will be much faster and more efficient.

There is a downside though. If you make a mistake, unless you have made a backup of your database data, you will not be able to fix it. Once the replacement is made, this text will no longer exist. So you need to be careful about what you look for.

That said, let's see how you can easily find and replace text in your WordPress database.

First steps

As we mentioned earlier, changes to your database will not be reversible. You need to take all the precautions to make sure that you don't lose any data.

You must first create a backup of your database. WordPress blog. You can do so using a backup plugin on WordPress. Alternatively, you can also create a backup of your database using phpMyAdmin.

After creating the backup of your WordPress database, you can run your search and replace.

Install and activate the Better Search Replace plugin on WordPress

If you are unfamiliar with the code and don't want to write a custom SQL query, then you can use a simple tool that will let you search and replace your database.

Better Search and renews, WordPress plugin

It allows you to perform search and replace from your WordPress dashboard.

How to search and replace on PHPMyAdmin

You can also use phpMyAdmin to find and replace text on your WordPress database.

You must first log in to your cPanel accommodation WordPress. Scroll down to the databases section, then click phpMyAdmin. This section may vary depending on accommodation.

CPanel PhpMyadmin

By clicking on it, you will arrive at phpMyAdmin where you will need to click on the name of the database of your WordPress blog then click on SQL. You will find the name of your database by downloading the wp-config.php file to the root of your accommodation.

tab-sql-phpmyadmin

You will need to enter your SQL query in this format:

update TABLE_NAME set FIELD_NAME = replace (FIELD_NAME, 'Text to find', 'Replacement text');

For example, if you want to search for text in the content of a WordPress post, then you should write your query like this:

update wp_posts set post_content = replace (post_content, 'Text to find', 'Text to replace');

Click on the 'Go' button to continue.

PhpMyAdmin will launch your SQL query and if successful, it will display the number of rows affected by the query.

You can now visit your WordPress site to view your changes.

We hope this tutorial has helped you find and replace text in a click on the database of your WordPress. Do not hesitate to contact us if you have problems using the tutorial plugin.