Support

Account

Home Forums General Issues ACF Google Map Coordinates

Unread

ACF Google Map Coordinates

  • Preface this by saying php is not my strong suit…I am trying to pull the coordinates from an ACF google map field into a field from another plugin I am using to automate a process in a custom post type. I am not sure how to pull the coordinate string from the google map field, any advice or input? The ACF field name is “map” and the field I am trying to populate is “_creamaps_locations”

    function rb_update_latlon($post_id, $post, $update) {
    $location = get_field(‘map’);
    if(isset($location[‘map’])) {
    $address = substr($location[‘address’], 1, strrpos($location[‘address’], ‘,’));
    update_post_meta( $post_id, ‘_creamaps_locations’, $address );
    }
    }
    add_action(‘save_post’, ‘rb_update_latlon’, 20, 3);

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.