Call: (209) 560-6611

Search and replace in wordpress

Date: November 17, 2012 Author: ang Category: Tutorials WordPress Tags: , Comments: 0

I've noticed that there are times then a WordPress website owner needs to replace text elements in all his posts. One user had been using alt tags in his links and wanted to replace then with the correct title tag. Another use had been using short code for a particular plugin for yeas and then changed to another plugin and needed to change all the outdated short code on his site. In this tutorial I'm going to show you how to replace a word or a text string with another word in all your WordPress posts at once using cPanel.

Search and replace in WordPress using cPanel & phpMyAdmin

  1. Log into your cPanel account.Note: If you're a 2slick.com customer, you can access your cPanel by navigating your browser to mywebsite.com/cpanel.
  2. Click on the 'phpMyAdmin' icon.
  3. You will see a list of databases on the left side on the screen. Your WordPress website database will be in the list. Click on your WordPress website database.
  4. Before we start replacing words in your WordPress website, let's back up the table we'll be modifying.
  5. Click on you 'posts' table. Your posts table will appear with an abbreviation as part of it for exampe 'wp_posts', 'wordpress_posts', etc.
  6. Click the 'Export' tab.
  7. Click the 'Go' button. Let the backup file download and make a note where it is. If you screw up your 'wp_posts' table, we'll need the backup file to fix it.
  8. Click on the 'Query window' icon .
  9. In the query window that pops up insert this command.
     MySQL |  copy code |? 
    1
    update wp_posts set post_content = replace(post_content,'duck','chicken') 
    Note: This command will replace all the instances of the word 'duck' with the word 'chicken' in all your posts throughout your WordPress site. Replace the words 'duck' and 'chicken' with the words you want to replace on your site.
  10. Click the 'Go' button that's on your query popup window.

That's it... if everything went well, the text should be replaced on all your posts.

Leave a Reply

Your email address will not be published. Required fields are marked *

Before you post, please prove you are sentient.

What is frozen water?

Before you post, please prove you are sentient.

What is 9 times 9?