WordPress core and third-party plugins often serialize arrays or objects as a way of storing structured data in the WordPress database. The method used to serialize this data is PHP’s own serialize() function. Some third-party plugins also store data as JSON, using PHP’s json_encode() function.
For example, WordPress core stores all widgets as serialized data in the options table. When URLs are present in widget data, a simple find and replace on an exported SQL file would corrupt the serialization and after importing that SQL file, the widgets no longer show up.
WP Migrate DB Pro properly handles this serialized data during a migration, executing find and replace on the serialized data without corrupting it. It unserializes the data, detects the data type, runs a find and replace on it (recursively for arrays), and serializes it again. It can operate on serialized strings, objects, and arrays. It also handles JSON encoded data.
Given you have the following array:
$array = array( 'url' => 'http://mysite.com' );
Your PHP serialized string would look like this:
Let’s say you’re about to migrate from http://mysite.com to http://yoursite.com
WP Migrate DB Pro would detect this as a serialized string, unserialize it and run the find & replace. Your serialized string would then look like this:
You’ll notice that the URL has been correctly updated and the string count has been updated to 19 from 17.