It is very common that we want to change our WordPress URL. For example when moving from development stage to final public release.
WordPress makes an intense use of serialize in order to make array persistent in the database. Serialization converts Arrays to Strings and stores some information the Array, such as the length of each value. If we make a massive URL update with the new URL we may look our plugins stop working, sidebar disappearing, widgets not showing and other kind of settings not working.
After several migrations I have made a tiny script that fixes this issue. The script searchs for serialized settings inside the wp_options table, it unserializes and replaces the old URL for the new one and updates this option.
Download WordPress Serialize Fix Script clicking here.
For a safe migration you should follow this instructions:
Before doing any database modification be sure to make a backup. In case of error you should restore the backup.
- Backup the original database (with the old URL).
- Import the database to the new host, if necessary.
- Download the script from here, and upload to your WordPress root folder.
- Edit wp-fixserial.php. Change oldomain.com and newdomain.com values.
- Execute wp-fixserial.php and wait for the script to finish.
- Follow the instructions in this post to update your database: http://jordiplana.com/wordpress-how-to-update-database-urls-in-a-recently-moved-installation
- Flush permalinks.
- EXTRA: Search in your theme and plugins for hardcoded URLs. Is a really ugly practise but you will be surprised how many times people do it…
I hope you ended successfully. Please let me know in that case!