I have been trying to import something into a custom field using the WordPress Import tool but it seems to be leaving the custom field empty in the database.

<wp:meta_value><![CDATA[a:19:{s:7:"address";s:50:"52, St. Michaels Rd,Sheffield,S359YN";s:11:"gpsLatitude";s:18:"";s:12:"gpsLongitude";s:18:"";s:18:"streetViewLatitude";s:9:"";s:19:"streetViewLongitude";s:18:"";s:17:"streetViewHeading";s:17:"";s:15:"streetViewPitch";s:18:"";s:14:"streetViewZoom";s:1:"0";s:9:"telephone";s:13:"01142570288";s:5:"email";s:19:"";s:3:"web";s:17:"";s:11:"hoursMonday";s:9:"";s:12:"hoursTuesday";s:9:"";s:14:"hoursWednesday";s:9:"";s:13:"hoursThursday";s:9:"";s:11:"hoursFriday";s:9:"";s:13:"hoursSaturday";s:6:"";s:11:"hoursSunday";s:6:"";s:18:"alternativeContent";s:0:"";}]]></wp:meta_value>

There doesn't seem to be anything massive sticking out with this, but when I use the importer tool it ignores this and leaves an empty space in the database.

Any ideas of what's happening or if there's something blatantly obvious that's missing?

  • I'm not sure if the WP Importer plugin really does import custom meta data. Do you have a proof that it has this functionality?
    – kaiser
    Feb 25, 2013 at 18:57
  • I can import from another xml file and it imports this data okay, but with this it just leaves an empty row in the database which is where im thinking there is something wrong with that line Feb 25, 2013 at 19:09
  • I have just been told that the length values were a miss match which is what was causing the issue! I knew it was something stupid! Feb 25, 2013 at 19:44
  • The import tool has several weaknesses (doesn't import menu item meta either). I use full database dumps when I can. Feb 25, 2013 at 19:56
  • @OliverWhysall PLEASE post this as answer and mark it as solution in two days. Thanks.
    – kaiser
    Feb 25, 2013 at 20:02

1 Answer 1


I have recently had a lesson in serialized arrays from a friend and it all makes sense now! After working this out it finally worked on the import.

Take this for example: a:1:{s:7:"address";s:50:"52, St. Michaels Rd,Sheffield,S359YN";}

  • a:1: This is the array size, there is one piece of information in this array hense the 1.
  • a:size:{key definition;value definition;(repeated per element)}

  • s:7:"address"; This is the the size of the value. So for address there are 7 characters in the word address so the value size is 7.

  • s:size:value;

  • There is also integer values shown like this:

    • i:value;
  • Bolean values are shown like this:

    • b:value; (does not store "true" or "false", does store '1' or '0')

that's all there basically is in a serialized array to worry about, and when correct the wordpress importer will import these into the database with no problems, but if they are wrong then it escapes itself and leaves the field in the database row empty.




 b:value; (does not store "true" or "false", does store '1' or '0')


 a:size:{key definition;value definition;(repeated per element)}

 O:strlen(object name):object name:object size:{s:strlen(property name):property name:property definition;(repeated per property)}

 String values are always in double quotes
 Array keys are always integers or strings
    "null => 'value'" equates to 's:0:"";s:5:"value";',
    "true => 'value'" equates to 'i:1;s:5:"value";',
    "false => 'value'" equates to 'i:0;s:5:"value";',
    "array(whatever the contents) => 'value'" equates to an "illegal offset type" warning because you can't use an
    array as a key; however, if you use a variable containing an array as a key, it will equate to 's:5:"Array";s:5:"value";',
    attempting to use an object as a key will result in the same behavior as using an array will.
  • The data is usually wrong because of line-endings. A very annoying problem. Jun 25, 2014 at 19:06
  • 2
    @Oliver Whysall, thanks for the lesson in serialized arrays, but what did you do to actually fix the exported data so it was able to be imported correctly? Aug 24, 2015 at 21:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.