Wed. Oct 30th, 2024

If you want replacing something which appears in many posts and doesn’t want to do one by one at a time, what do you need to do?

All of us knowing that when replacing things in your blog, it’s a nightmare and time consuming, but don’t worry there is an alternative for you to take care these stuffs without wasting of your time; just one click, all of them are replaced. Then next time if you want to change something, you’re no longer afraid of touching your database and one day you might be a database expert, who knows.

Here is what you need to do:

  1. Log in your phpMyAdmin
  2. Click on the database table you need to change (usually, these db are displayed on the left hand side of the screen)
  3. Click on SQL which is on the top panel of the right side of the screen.
  4. In the big empty box, place the following code
    Database syntax:
    UPDATE tablename SET tablefield = replace(tablefield, "find_string", "replace_string");
    For example:
    UPDATE wp_posts SET post_content = replace(post_content,"Money","2013 money");
    – The above code is about replacing the word “Money” to the phrase “2013 money” in the content of the post.
    Remember:
    – Change wp_posts to the name of your database table.
    – Change post_content to the name of the table you want to change.
    – Change the word “Money” with the word/phrase you’re looking to replace and
    – Change the word “2013 money” to the word/phrase you want to replace the word “Money“.
  5. Click Go
  6. After it’s completed, a green message will pop up letting you know that’s done and how many queries which it had taken care off.
  7. That’s all you need to do.

*** WARNING ***
Before starting to do anything with your database, you need to backup it just for in case you did something wrong and the database is broken, you won’t be panic and your blog is able to recovery.

(Visited 11 times, 1 visits today)

Leave a Reply