There were times that I need to replace something from the content of my blog. But searching for those things takes time especially if you’re not using any of the plugins for WordPress (since my blog is run by WordPress).
The only fast way to search and replace is by doing the process directly at your database. So, here’s what you need to do:
1. Login to your CPanel account. Most of the time, webhosting companies allow its clients to access their CPanel account by loging into mywebsitedomain.com/cpanel.
2. Open the PHPMyAdmin. Browse your CPanel home page and find for the icon of the PHPMyAdmin. After clicking on that icon, a new window will open and redirecting you to your PHPMyAdmin.
3. Open the Database file. On the left side of your PHPMyAdmin, you’ll find several database files. Just click the right database file to open it.
4. Open the SQL window. On the right window and on the top of the page, find the link SQL and click on it.
5. Type and Run an SQL command. On the blank field type this: UPDATE table-name SET field-name = REPLACE( field-name, ’the string to be searched‘, ’the string that will replace the old and searched strings‘ ) then click the GO.
Note: Replace the following:
table-name : replace it with the name of the table in the database
field-name: replace it with the name of the field in the specified table of the database
the string to be searched: this is the term you want to be replaced with.
the strong that will replace the searched strings : this is the term that will replace the string to be searched.
For example, If you want to search and replace the http://narutoshippuuden.selaplana.com/ found in all of the posts of your WordPress blog with the http://www.narutoshippuudenfan.com, just use the sql command below:
update wp_posts set post_content = replace(post_content, ‘http://narutoshippuuden.selaplana.com/’, ‘http://www.narutoshippuudenfan.com’);