Title: Table remain empty
Last modified: January 22, 2018

---

# Table remain empty

 *  [jeff2mars](https://wordpress.org/support/users/jeff2mars/)
 * (@jeff2mars)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/table-remain-empty/)
 * Hi
    I’m using the plugin but the table remains empty. My field is address. Do
   you have a solution ? Thanks

Viewing 15 replies - 1 through 15 (of 24 total)

1 [2](https://wordpress.org/support/topic/table-remain-empty/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/table-remain-empty/page/2/?output_format=md)

 *  Plugin Author [raiserweb](https://wordpress.org/support/users/raiserweb/)
 * (@raiserweb)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/table-remain-empty/#post-9889673)
 * Are you using ACF?
 *  // bail early if no ACF data
    if( empty($_POST[‘acf’]) ) { return; }
 *  Thread Starter [jeff2mars](https://wordpress.org/support/users/jeff2mars/)
 * (@jeff2mars)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/table-remain-empty/#post-9889704)
 * yes im using ACF, and my google map field is named address in acf.
 * You agree that I should let everything in the acf radius search folder even the
   functions.php ?
 *  Plugin Author [raiserweb](https://wordpress.org/support/users/raiserweb/)
 * (@raiserweb)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/table-remain-empty/#post-9889731)
 * How you mean? Have you added this is a plugin? Yes the functions.php needs to
   be included – it contains the hook the will catch a post save, and update the
   address long lat in the table. ( function acf_google_maps_search_save_post( $
   post_id ) { )
 * The plugin is small – I would recommend browsing the plugin files, and taking
   a look.
 *  Thread Starter [jeff2mars](https://wordpress.org/support/users/jeff2mars/)
 * (@jeff2mars)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/table-remain-empty/#post-9889747)
 * yes ok it’s a plugin, then it’s well installed like other plugins but the table
   is still empty. Does it work with products ? My address field is only filled 
   for some products, not for all… may it be the problem ?
 *  Plugin Author [raiserweb](https://wordpress.org/support/users/raiserweb/)
 * (@raiserweb)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/table-remain-empty/#post-9889765)
 * It should work for products, since they are posts
 * To debug, please check that the action is firing (located in advanced-custom-
   fields-google-maps-search.php )
 * // save post
    add_action(‘acf/save_post’, ‘acf_google_maps_search_save_post’,
   20);
 * Then check that this function has the correct data (located in functions.php)
 * function acf_google_maps_search_save_post( $post_id ) {
 *  // bail early if no ACF data
    if( empty($_POST[‘acf’]) ) { return; }
 *  $address = get_field( ‘address’, $post_id );
 *  if( $address ){
 *  $acf_gms = new acf_gms;
 *  $data = [
    ‘post_id’ => $post_id, ‘lng’ => $address[‘lng’], ‘lat’ => $address[‘
   lat’], ];
 *  $acf_gms->save( $data );
    }
 * }
 *  Thread Starter [jeff2mars](https://wordpress.org/support/users/jeff2mars/)
 * (@jeff2mars)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/table-remain-empty/#post-9889821)
 * i’m sorry but how could I check if the action is firing ?
 *  Plugin Author [raiserweb](https://wordpress.org/support/users/raiserweb/)
 * (@raiserweb)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/table-remain-empty/#post-9889839)
 * You can perform the action on the front end (ie save the post), and add a var_dump
   + exit in the php function (acf_google_maps_search_save_post) to see if the browser
   displays the var_dump.
 * This plugin is intended for developers only
 *  Thread Starter [jeff2mars](https://wordpress.org/support/users/jeff2mars/)
 * (@jeff2mars)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/table-remain-empty/#post-9889864)
 * I modify the following code, it’s showing nothing special
 *     ```
       function acf_google_maps_search_save_post( $post_id ) {
   
          // bail early if no ACF data
          if( empty($_POST['acf']) ) {
       	   return;
          }	
   
   
       	$address = get_field( 'address', $post_id );
   
       	if( $address ){
   
       		$acf_gms = new acf_gms;	
   
       		$data = [
       			'post_id'	=> $post_id,
       			'lng'		=> $address['lng'],
       			'lat'		=> $address['lat'],
       		];
       		var_dump($address); exit;
       		$acf_gms->save( $data );		
   
       	}
   
   
       }
       ```
   
    -  This reply was modified 8 years, 4 months ago by [jeff2mars](https://wordpress.org/support/users/jeff2mars/).
 *  Plugin Author [raiserweb](https://wordpress.org/support/users/raiserweb/)
 * (@raiserweb)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/table-remain-empty/#post-9889910)
 * Try this first. If no var dump, then you know the hook is not firing.
 * function acf_google_maps_search_save_post( $post_id ) {
 *  var_dump($address); exit;
 *  // bail early if no ACF data
    if( empty($_POST['acf']) ) { return; }
 *  $address = get_field( 'address', $post_id );
 *  if( $address ){
 *  $acf_gms = new acf_gms;
 *  $data = [
    'post_id' => $post_id, 'lng' => $address['lng'], 'lat' => $address['
   lat'], ];
 *  $acf_gms->save( $data );
 *  }
 * }
 *  Plugin Author [raiserweb](https://wordpress.org/support/users/raiserweb/)
 * (@raiserweb)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/table-remain-empty/#post-9889914)
 * Sorry I mean this:
 * function acf_google_maps_search_save_post( $post_id ) {
 * echo ‘test’; exit;
 * // bail early if no ACF data
    if( empty($_POST[‘acf’]) ) { return; }
 * $address = get_field( ‘address’, $post_id );
 * if( $address ){
 * $acf_gms = new acf_gms;
 * $data = [
    ‘post_id’ => $post_id, ‘lng’ => $address[‘lng’], ‘lat’ => $address[‘
   lat’], ];
 * $acf_gms->save( $data );
 * }
 * }
 *  Thread Starter [jeff2mars](https://wordpress.org/support/users/jeff2mars/)
 * (@jeff2mars)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/table-remain-empty/#post-9889956)
 * “test is displayed.
 * and with var_dump :
 * Notice: Undefined variable: address in C:\wamp64\www\wp-content\plugins\acf-google-
   maps-radius-search\functions.php on line 3
    C:\wamp64\www\wp-content\plugins\
   acf-google-maps-radius-search\functions.php:33:null
 *  Plugin Author [raiserweb](https://wordpress.org/support/users/raiserweb/)
 * (@raiserweb)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/table-remain-empty/#post-9889965)
 * Ok, since test is displayed, it shows that the function is firing when you save
   a product.
 * So I’m afraid I’ll have to leave the rest to you to debug. Maybe $_POST[‘acf’]
   is empty
 *  Thread Starter [jeff2mars](https://wordpress.org/support/users/jeff2mars/)
 * (@jeff2mars)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/table-remain-empty/#post-9889981)
 * yes, when I try do display $_POST[‘acf’] I get
 *  Notice: Undefined index: acf in C:\wamp64\www\wp-content\plugins\acf-google-
   maps-radius-search\functions.php on line 33
 * I don’t know why…
 *  Plugin Author [raiserweb](https://wordpress.org/support/users/raiserweb/)
 * (@raiserweb)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/table-remain-empty/#post-9890015)
 * Not sure. Try commenting this if statement
 * function acf_google_maps_search_save_post( $post_id ) {
 * // bail early if no ACF data
    //if( empty($_POST[‘acf’]) ) { //return; //}
 * $address = get_field( ‘address’, $post_id );
 * if( $address ){
 * $acf_gms = new acf_gms;
 * $data = [
    ‘post_id’ => $post_id, ‘lng’ => $address[‘lng’], ‘lat’ => $address[‘
   lat’], ];
 * $acf_gms->save( $data );
 * }
 * }
 *  Thread Starter [jeff2mars](https://wordpress.org/support/users/jeff2mars/)
 * (@jeff2mars)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/table-remain-empty/#post-9890056)
 * ok when commenting, a line is added to the table !
 * but the older posts that have an address are not inserted in the table (assuming
   that the function update_historic_post_gm_data() is supposed to do that)
    -  This reply was modified 8 years, 4 months ago by [jeff2mars](https://wordpress.org/support/users/jeff2mars/).

Viewing 15 replies - 1 through 15 (of 24 total)

1 [2](https://wordpress.org/support/topic/table-remain-empty/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/table-remain-empty/page/2/?output_format=md)

The topic ‘Table remain empty’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/acf-google-maps-radius-search.svg)
 * [ACF Google Maps Radius Search](https://wordpress.org/plugins/acf-google-maps-radius-search/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/acf-google-maps-radius-search/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/acf-google-maps-radius-search/)
 * [Active Topics](https://wordpress.org/support/plugin/acf-google-maps-radius-search/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/acf-google-maps-radius-search/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/acf-google-maps-radius-search/reviews/)

## Tags

 * [Radius search](https://wordpress.org/support/topic-tag/radius-search/)

 * 24 replies
 * 2 participants
 * Last reply from: [jeff2mars](https://wordpress.org/support/users/jeff2mars/)
 * Last activity: [8 years, 4 months ago](https://wordpress.org/support/topic/table-remain-empty/page/2/#post-9909782)
 * Status: not resolved