04 октомври, 2012

Posts and pages looks weird after domain switch.

Any now and then you are transferring some existing site to a new domain. Or you are just making a demo/test/development copy to another folder. So you follow the best practices and backup all data, alter the database to suit the new domain/folder, create new database, import the tables, altering the wp-config and uploading the files again. Most of the cases this is enough for your new WP installation to work with no problems, but! Sometimes some elements on your site look strange, misplaced or don't show at all. And you start wondering "I've copied everything, why the two installations are different?"

Here is a tip that can guide you. Do you use custom meta fields for the posts? Did you just made a find-and-replace of the old domain/folder with the new ones? Well, then you probably replaced this inside some serialized values of the meta tables also. And now the unserialize returns false because the value is no longer valid. So you have to (manually) recalculate the differences in character lengths and replace the count on every occurrence. Hopefully your database is not so long :)

Oh, and don't forget to freshen the permalinks.

Няма коментари: