With WordPress Importer, why can’t I import post meta containing a multi-dimensional array, in which value(s) of that array contain line breaks?

I would wage that your issue is with \r\n (CRLF). If the newlines are created in Windows, they’ll go into the database as \r\n and when serialized get counted as 2 characters. Then when importing, they’ll only be counted as 1 character and they’ll corrupt the string. I tested this hypothesis and sure enough I was able to create a corrupt serialized string.

If this is your issue, the solution would be to replace "\r\n" with "\n" when saving the post meta. This is a long shot, but I can’t think of what else might cause this behavior. Give ‘er a shot and let me know how it works out!

Leave a Comment