There may be a time when you want to find and replace common text that is throughout your WordPress website.
Replacing WordPress Text Using phpMyAdmin is the fastest way to accomplish this, and it is not that difficult to do.
This is also a very easy way to change the colors of your website. Find the html color (ie. ##e09900) that you want to change, and replace that with what color you want to change it to.
Using phpMyAdmin to Change Text
If you are not familiar with phpMyAdmin, this may seem a little daunting at first, but if you follow these instructions, you will make yourself look like a genius!
Step 1) Login to your web hosts cPanel, (in the image examples below I am using BlueHost, but whatever cPanel you are using, it should look pretty similar.) Scroll down your cPanel and look for and click the phpMyAdmin button.
Step 2) If you have more than one website locate and click the database on the left of the screen, if you are unsure what database your website is using, you can locate it by going into your file manager, and locate a file called wp-config.php in your website folders main directory. Click to edit that file and find your database name in the define('DB_NAME', 'your_database');
Once you clicked your correct database, from the left menu, click the SQL tab from the top menu.
Step 3) Copy and Paste the code below into that section, replacing ’Text to find’,’text to replace with’ with your own. Then when you have it right, click the go button on the bottom right and all of the areas in your website that were using that text string will be replaced with your new one.
update wp_posts set post_content =
replace(post_content,'Text to find','text to replace with');
Now you can click the 'Simulate query' button, and that will let you know in advance how many instances it will change, and/or click "Go" to make the changes.
Use MySQL Scripts to Find and Replace URLs in the Database
Another way to search and replace old URLs in the database is by using MySQL scripts. This method is very useful if you are running a big and complicated website.
By using this MySQL script you can easily replace old URLs with new ones:
update TABLE_NAME set FIELD_NAME = replace(FIELD_NAME, ‘find string’, ‘replace string’);
This command is used to search and replace old URLs in your database tables. If you wish to change every URL in your tables, first open your cPanel and open phpMyAdmin.
Select your website’s database. From the toolbar click on SQL and type in the code below:
UPDATE wp_options SET option_value = replace(option_value, 'Existing URL', 'New URL') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET post_content = replace(post_content, 'Existing URL', 'New URL');
UPDATE wp_postmeta SET meta_value = replace(meta_value,'Existing URL','New URL');
UPDATE wp_usermeta SET meta_value = replace(meta_value, 'Existing URL','New URL');
UPDATE wp_links SET link_url = replace(link_url, 'Existing URL','New URL');
UPDATE wp_comments SET comment_content = replace(comment_content , 'Existing URL','New URL');
Good stuff!
About the Author:
The SEO-Alien is a project started in 2009 regarding all things online marketing. The site started out more of a diary of predictions, suggestions and references to things I frequently used for online marketing... before social media marketing was even an option.
I hope you find the information and tools presented here useful and something worth sharing with others.
If there is anything else about online marketing or any online advertising strategy you think would be helpful, please let me know.