If you work with multiple environments (development, staging, production etc) when building WordPress sites, you’ll know that WordPress uses hardcoded absolute URLs in the database for various tasks. There are lots of arguments as to why this is done, and whether it’s the best solution, but for now it remains quite difficult to migrate WordPress between environments.
Having worked in this way for a number of years, I’ve developed a script to help change the URL of a WordPress installation. This script, called Migrate! is now available to download.
Migrate! Essentially takes two URLs – the one you’re migrating from, and the one you’re migrating to, and replaces one with the other in all relevant parts of the database. The database queries used to do this have been actively tested in migrating sites to various production environments. The user interface and interactions are in development.
Necessary disclaimer: I take no responsibility for problems caused by the script, but you should have a backup beforehand anyway by the very nature of the script! Also.. anything you do with the script can be easily and completely reversed by switching the “from” and “to” URLS.
Why is this not a plugin?
Once WordPress’ files and database have been moved to a new URL, it is no longer possible to successfully login to and navigate around the WordPress backend without migrating the URL in the database. Therefore, the problem with having a migration script as a plugin is that the work to replace the URLs in the database would have to be done on the original install before the files and database are moved to the new server.
This means running the plugin, moving the install, and then running the plugin on the old install again if you still need it for futher development etc. In addition, many people, who don’t work with WordPress all the time, don’t realise there is a problem with migrating WordPress to a new URL until they try to do it.
So these are the main reasons for not having it as a plugin. However, there is a plugin version, which will hopefully also handle some other task involved in migrating a site, planned for the future.