Wordpress migration, the right way

Fri, 10/19/2012 - 04:36 -- Kyle Skrinak
There's much noise on this topic and I was merely adding to the fog. The problem: Wordpress puts too much importance on the fully qualified URLs. So, moving a site around means updating the URLs in the database. Searching and replacing the database won't work, as Wordpress stores serialized data. Over at stackexchange, Chip Bennett gave me the right bearings for fixing this issue. Being the last to the party isn't always a bad thing. It appears that David Coveney has done some heavy and important lifting for WordPress. Turns out there's an excellent php script to move things along: The (ta-da) Wordpress Search and Replace Tool. The process is simple:
  1. Push up your changed files (Rsync is the bomb. I can't say it enough. Hosts that force you to use FTP draw my ire, and you remain legion)
  2. Update your remote MySQL server (do not making any URL changes!)
  3. For measure I confirm my current siteURL and home values before the run:
    • select option_value from wp_options where option_name = 'home' or option_name = 'siteurl';
  4. Run SearchReplaceDB2.php. It reads my wp-config.php for database connection information.
  5. Search and replace your dev URL values with your production URL values
  6. Remove SearchReplaceDB2.php IMMEDIATELY. (I'm worried that I had to point that out.)
  7. Test your site's links.
I have been using this script with much success. Of course, all is not well. David's latest blog post details he's having with URL parameters and exports. But for the time being  the above has greatly reduced my surprises with wordpress dev to production synchronization.