Title: Save_post Doesn&#8217;t Execute from WordPress iOS App
Last modified: May 26, 2018

---

# Save_post Doesn’t Execute from WordPress iOS App

 *  Resolved [mikedunn](https://wordpress.org/support/users/mikedunn/)
 * (@mikedunn)
 * [8 years ago](https://wordpress.org/support/topic/save_post-doesnt-execute-from-wordpress-ios-app/)
 * I wrote a theme function (I’m new at this) to take GPS coordinates in custom 
   fields, pass them to the Google Maps API to get the actual location name, then
   put that result into another custom field. It works fine when I publish or update
   a post from wp-admin, but it never fires from the WordPress iOS app. (The app
   otherwise works fine.) Having it work from iOS is kind of important because that’s
   how I get the coordinates.
 * I’ve tried numerous different actions (save_post, publish_post, xmlrpc_publish_post,
   etc.) but none of them fire. Do these actions simply not fire from the iOS app
   for some reason?
 *     ```
       /* Query Google Maps API for location name */
           function get_place_name($post_id, $post, $update) {
           $lat = get_post_meta(get_the_ID(), 'geo_latitude', true);
           $lng = get_post_meta(get_the_ID(), 'geo_longitude', true);
           $url = 'https://maps.googleapis.com/maps/api/geocode/json?latlng=' . trim($lat) . ',' . trim($lng) . '&sensor=false&key=<KEY>';
           $json = @file_get_contents($url);
           $data = json_decode($json);
           $status = $data->status;
           if ($status == "OK"){
               $long_name_1 = $data->results[0]->address_components[0]->long_name;
               $long_name_2 = $data->results[0]->address_components[1]->long_name;
               $long_name_3 = $data->results[0]->address_components[2]->long_name;
               $placename = $long_name_1 . ', ' . $long_name_2 . ', ' . $long_name_3;
               update_post_meta(get_the_ID(), 'geo_googlemapsapi_url', $url);
               update_post_meta(get_the_ID(), 'geo_place_name', $placename);}
           else {
               update_post_meta(get_the_ID(), 'geo_place_name', 'No location found');
           }
           }
           add_action('save_post', 'get_place_name', 10, 3);
       ```
   

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Moderator [James Huff](https://wordpress.org/support/users/macmanx/)
 * (@macmanx)
 * [8 years ago](https://wordpress.org/support/topic/save_post-doesnt-execute-from-wordpress-ios-app/#post-10325358)
 * I recommend asking at [https://ios.forums.wordpress.org/](https://ios.forums.wordpress.org/)
   so the app’s developers and support community can help you with this.
 *  Thread Starter [mikedunn](https://wordpress.org/support/users/mikedunn/)
 * (@mikedunn)
 * [8 years ago](https://wordpress.org/support/topic/save_post-doesnt-execute-from-wordpress-ios-app/#post-10326926)
 * I’ll do that. Thanks.
 *  Moderator [James Huff](https://wordpress.org/support/users/macmanx/)
 * (@macmanx)
 * [8 years ago](https://wordpress.org/support/topic/save_post-doesnt-execute-from-wordpress-ios-app/#post-10327643)
 * You’re welcome!
 * Topic continues at [https://ios.forums.wordpress.org/topic/save_post-doesn’t-execute-from-wordpress-ios-app](https://ios.forums.wordpress.org/topic/save_post-doesn’t-execute-from-wordpress-ios-app)

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Save_post Doesn’t Execute from WordPress iOS App’ is closed to new replies.

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 3 replies
 * 2 participants
 * Last reply from: [James Huff](https://wordpress.org/support/users/macmanx/)
 * Last activity: [8 years ago](https://wordpress.org/support/topic/save_post-doesnt-execute-from-wordpress-ios-app/#post-10327643)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
