Whatever operation you perform on a WordPress database, don’t forget to backup it before you start!

Find & Replace with Worpdress Plugin

Better Search and Replace Plugin is one of the most popular WordPress plugins which does the job. It provides you with an interface in WP-Admin to find and replace text across all database tables. All you need to do is download, install, and activate the plugin and you are ready to go. It is easy and straightway to use. There are also other plugins that do the same job for you. Just take a look at WordPress repository.

Better Seach And Replace

Better Seach And Replace

Although very easy to implement, WordPress plugin method for find and replace in databases provides limited functionality. You can only search in the current database. This is the blog’s database. If you want to be able to extended find and replace with regular expressions, you should use more advanced methods.

Search & Replace With PHPMyAdmin

This method requires an external program, PHPMyAdmin, installed at your hosting. As phpMyAdmin is a free software tool, intended to handle the administration of MySQL over the Web, I can bet you have it installed on your hosting account. As always, don’t forget to backup your databases.
After backing up, open your database with PhpMyAdmin. The content of your blog is located in “wp_post” table.
Click on the SQL tab. If you want to change something in your post’s content, here is the example to tackle the problem:

UPDATE `wp_posts` SET `post_content` = replace(post_content,
'string1',
'string2')

PHPMyAdmin

PHPMyAdmin

Find & Replace In Multiple Tables

Manual Find & Replace Within PHPMyAdmin

In order to do manual search and replace with PHPMyAdmin, you can select the table you wont to change. It can be post_content as in the example above. Click on the Search tab. Then select the ‘Find and replace’ submenu. It will take you to a place where you can enter the unwanted (find) ‘String1’ wanted (replace with) ‘String2’ and drop-down menu with the columns of the table you can perform the operation.
This option is not quicker than the one above, it is less techie only.

In the examples above I am using SQL commands to change ‘String1’ to ‘String2’ within the post_content field, or do it manually. If you want to change media files or custom fields, the table to work with, is ‘wp_postmeta’.

In all the above cases we have single table update. If you face the need to change multiple tables at once, make a dump of the database, search/replace within, and then upload it back. This will save you time and effort.

Categories: Wordpress

Leave a Reply

Your email address will not be published.

Related Posts

Wordpress Plugins

Free Social Networks Autoposters

The scope of this article is far beyond explaining the crucial importance of social media networks for blog authors and publishers. Social networks are the best traffic sources nowadays. Creating fan club and getting your Read more…

Wordpress

WordPress 4.7.1 Vulnerability Hacked By SA3D HaCk3

WordPress 4.7.1 Vulnerability Hacked By SA3D HaCk3 Recently one of my clients had two of their wordpress websites hacked. The main evidence were two posts added to the blogs with a title either ‘Hacked By Read more…

Wordpress Plugins

Top Free Slider Plugins For WordPress

It has become blogging fashion to show off your images and videos with a slider. Sliders are cool and great for visual representation of the media. They are great for review bloggers as they showcase Read more…