Home Forums Backend Issues (wp-admin) Get google maps field data without db markup?


Get google maps field data without db markup?

  • Ok, so here’s a weird situation.

    A few years ago I developed a website that included ACF Google Map field.
    I have a custom plugin that runs exports of data into csv files, and it included the Google Map field data.

    It used to export like this:

    6278 Spruce St, Ipperwash Beach ON|43.2068004,-81.9973091

    But now, when the data is saved, it exports like this:

    a:3:{s:7:”address”;s:51:”70671 Bluewater Highway Grand Bend, Ontario N0M 1T0″;s:3:”lat”;s:10:”43.3203177″;s:3:”lng”;s:18:”-81.75439059999997″;}

    I’m assuming something in the way ACF saves the field to the DB has changed, but I’m not sure how to get the details without the a:3:{s:7 kind of markup….

    Is there a way to get this cleanly from the DB? I’m calling the custom field as an array.

    Possible? Or alternatively, can i somehow call the raw address without the coordinates?


  • The value of the map field is stored as an array, which is serialzed for storage in the database.

    I don’t know how your export works but converting to the old value might look something like

    // $value holds value from the DB
    $value = maybe_unserialize($value);
    $value = $value['address'].'|'.$value['lat'].','.$value['lng'];
Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Get google maps field data without db markup?’ is closed to new replies.