Title: Posts Locator Function &#8211; Not working
Last modified: January 4, 2019

---

# Posts Locator Function – Not working

 *  [DenisCGN](https://wordpress.org/support/users/deniscgn/)
 * (@deniscgn)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/posts-locator-function-not-working/)
 * Hello,
 * I can not get the “Posts Locator Function” `gmw_update_post_location( $post_id,
   $address );` work with the Google Maps API Key. I followed your instruction [https://docs.gravitygeolocation.com/article/134-how-to-create-browser-and-server-google-maps-api-keys](http://Google API instruction)
   to create 2 Keys, browser and server key.
    It does not work/update. When I use
   LeafLet it works fine. Even if I update with an Address string or an lat/lng 
   array.
 * So it must be something with the google API. And, I cant even find your TESTING
   Tab for checking if the API works 🙁
 * I am Using the WPUF pro. And I use this funuction:
 *     ```
       function update_GEOmyWP( $post_id ) {
   
       // make sure post ID exists.
       if ( ! $post_id ) {
       	return;
       }
   
       // verify the updater function.
       if ( ! function_exists( 'gmw_update_post_location' ) ) {
       	return;
       }
   
       if ( isset( $_POST['aufnahmeort'] ) ) {
   
       	list( $adresse, $lat, $lng ) = explode( '||', $_POST['aufnahmeort'] );
   
       	$location = array( $lat, $lng );
   
       	if ( $adresse ) {
       		update_post_meta( $post_id, 'newADDRESS', $adresse );
       	}
       	if ( $lat ) {
       		update_post_meta( $post_id, 'newLAT', $lat );
       	}
       	if ( $lng ) {
       		update_post_meta( $post_id, 'newLONG', $lng );
       	}
   
       	gmw_update_post_location( $post_id, $location );
   
       }
       }
       add_action( 'wpuf_add_post_after_insert', 'update_GEOmyWP' );
       add_action( 'wpuf_edit_post_after_update', 'update_GEOmyWP' );
       ```
   
 * Please help 🙂
    Cheers, Denis

Viewing 1 replies (of 1 total)

 *  Thread Starter [DenisCGN](https://wordpress.org/support/users/deniscgn/)
 * (@deniscgn)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/posts-locator-function-not-working/#post-11053397)
 * **UPDATE:**
 * well, I installed the BETA3 version, where I could find that browser and server
   key fields. And the google API check. The check was GOOD 🙂
 * So now, I tried to use the ARRAY of lat and lng.
 * But how is this ARRAY created?
 * like this: `$location = array( $lat, $lng );` the function does not work.
 * When I use `$location = $adresse;` (address string) it works.
 * How can I make it work with the lat lng?
 * And, how das it work with `$location_name`? I thought it will take the Post Title.
   If I try to use `$location_name = 'Hello';` nothing works again 🙁
 * Thanks,
    Denis
    -  This reply was modified 7 years, 4 months ago by [DenisCGN](https://wordpress.org/support/users/deniscgn/).
    -  This reply was modified 7 years, 4 months ago by [DenisCGN](https://wordpress.org/support/users/deniscgn/).

Viewing 1 replies (of 1 total)

The topic ‘Posts Locator Function – Not working’ is closed to new replies.

 * ![](https://ps.w.org/geo-my-wp/assets/icon-256x256.gif?rev=2803407)
 * [GEO my WP](https://wordpress.org/plugins/geo-my-wp/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/geo-my-wp/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/geo-my-wp/)
 * [Active Topics](https://wordpress.org/support/plugin/geo-my-wp/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/geo-my-wp/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/geo-my-wp/reviews/)

## Tags

 * [function](https://wordpress.org/support/topic-tag/function/)
 * [wpuf](https://wordpress.org/support/topic-tag/wpuf/)

 * 1 reply
 * 1 participant
 * Last reply from: [DenisCGN](https://wordpress.org/support/users/deniscgn/)
 * Last activity: [7 years, 4 months ago](https://wordpress.org/support/topic/posts-locator-function-not-working/#post-11053397)
 * Status: not resolved