Background: I downloaded a *.sql backup of my WordPress site\'s database, and replaced all instances of the old database table prefix with a new on
I came to this same problem after trying to change the domain from localhost to the real URL. After some searching I found the answer in Wordpress documentation:
https://codex.wordpress.org/Moving_WordPress
I will quote what is written there:
To avoid that serialization issue, you have three options:
- Use the Better Search Replace or Velvet Blues Update URLs plugins if you can > access your Dashboard.
- Use WP-CLI's search-replace if your hosting provider (or you) have installed WP-CLI.
- Run a search and replace query manually on your database. Note: Only perform a search and replace on the wp_posts table.
I ended up using WP-CLI which is able to replace things in the database without breaking serialization: http://wp-cli.org/commands/search-replace/