0

I'm exporting the content of one plugin to another much more robust plugin. In the data I export, there are fields that come with keys. There is a way to export each one independently (in a column each):

example:

Address | Latitude | Longitude | Email | ....

Image data

UPDATE

Thanks to the suggestion to use "serialized", now to export the data I am using the plugin "All Export" which allows me to embed functions for custom fields.

I have a question about what the name of the data is, in the custom field option it is _ait-dir-item, but with that name it does not work.

enter image description here

If I do it manually taking the data as $mydata, if it works:

function aaa() {
$mydata = 'a:52:{s:7:"address";s:59:"San José Costa Rica 100mts al Sur de Walmart en Guadalupe.";s:11:"gpsLatitude";s:9:"9.9393783";s:12:"gpsLongitude";s:18:"-84.05499370000001";s:14:"showStreetview";a:1:{s:6:"enable";s:6:"enable";}s:18:"streetViewLatitude";s:17:"9.942617316557271";s:19:"streetViewLongitude";s:18:"-84.06036884686585";s:17:"streetViewHeading";s:1:"0";s:15:"streetViewPitch";s:1:"0";s:14:"streetViewZoom";s:1:"0";s:9:"telephone";s:9:"2253-6563";s:5:"email";s:0:"";s:3:"web";s:0:"";s:11:"hoursMonday";s:15:"8:00am - 6:00pm";s:12:"hoursTuesday";s:15:"8:00am - 5:00pm";s:14:"hoursWednesday";s:7:"Cerrado";s:18:"alternativeContent";s:0:"";s:10:"socialImg1";s:0:"";s:11:"socialLink1";s:23:"http://www.facebook.com";s:10:"socialImg2";s:0:"";s:11:"socialLink2";s:22:"http://www.twitter.com";s:10:"socialImg3";s:0:"";s:11:"socialLink3";s:22:"http://plus.google.com";s:10:"socialImg4";s:0:"";s:11:"socialLink4";s:24:"http://www.instagram.com";s:10:"socialImg5";s:0:"";s:11:"socialLink5";s:24:"http://www.pinterest.com";s:10:"socialImg6";s:0:"";s:11:"socialLink6";s:0:"";s:12:"specialTitle";s:0:"";s:14:"specialContent";s:0:"";s:12:"specialImage";s:0:"";s:12:"specialPrice";s:0:"";s:8:"gallery1";s:0:"";s:8:"gallery2";s:0:"";s:8:"gallery3";s:0:"";s:8:"gallery4";s:0:"";s:8:"gallery5";s:0:"";s:8:"gallery6";s:0:"";s:8:"gallery7";s:0:"";s:8:"gallery8";s:0:"";s:8:"gallery9";s:0:"";s:9:"gallery10";s:0:"";s:9:"gallery11";s:0:"";s:9:"gallery12";s:0:"";s:9:"gallery13";s:0:"";s:9:"gallery14";s:0:"";s:9:"gallery15";s:0:"";s:9:"gallery16";s:0:"";s:9:"gallery17";s:0:"";s:9:"gallery18";s:0:"";s:9:"gallery19";s:0:"";s:9:"gallery20";s:0:"";}';
$mydata = unserialize($mydata);
echo $mydata['gpsLongitude'];
0

For plugin "All Export": Create the necessary functions and give it to save and then in each created field add the name of the function corresponding to the necessary field and the variable containing the data is $value, example:

function address($value){
$data = maybe_unserialize($value);
$data = $data[address];
return $data;
}

function latitud($value){
$data = maybe_unserialize($value);
$data = $data[gpsLatitude];
return $data;
}

With this you will get the value of each field.

1

if you're using PHP to handle the export or the import, you can parse the serialized meta values with unserialize()

$wp_meta_value_array = unserialize($wp_meta_value);

// print_r($wp_meta_value_array);
// will output
// 'address' => '...'
// 'gpslat..' => '...'

So whatever your import is, you can then do

$new_address = $wp_meta_value_array['address'];
  • Thanks for the response, I'm using serialized and advanced a bit, but to compose the function I still have not been able to. I have updated the question ↑ ↑ ↑ – Mario Burga Apr 29 '18 at 21:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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