Is there any plugin that can update the wordpress database, specifically the wp_posts table or any other custom table in the database created by other plugins which has absolute url's of images and other assets?

So for example I have an image in a post:

<img src="http://old-domain.com/wp-content/uploads/images/img.png" />

How do I update it when moving to new-domain.com? And also I have created a plugin that does save absolute URL's on a custom table. Should I also provide the functionality to update those URL's? I'm currently using the content_url() method which returns an absolute URL for the assets that the plugin is saving. Is there any way of modifying this so it uses relative paths so there will be no need for a migrate functionality if ever? Thanks in advance!


2 Answers 2


I had much success using https://github.com/interconnectit/Search-Replace-DB

Though there are Plugins for WordPress available that do a Search & Replace, i recommend the above linked script.

In older WordPress versions it was possible to move an entire site by simply replacing some strings, but as far as i know, WordPress now creates hashes/indexes for some strings you save in the db. If you simply search and replace these strings, the hashes/index wont match anymore and you lose your settings. The script above tries to solve this and updates also the index/hash.


Please export the database tables and then find and replace the old URL with new url and then import the database tables again. This is the best option and will take only 2-3 mins and also it will depend upon your database size.

I hope it will helpful for you.


  • 1
    You have to be careful doing that, because you could damage the serialized data. Example: s:11:"example.com" vs s:15:"new.example.com"
    – birgire
    Sep 12, 2013 at 10:31

Not the answer you're looking for? Browse other questions tagged or ask your own question.