Support

Account

Home Forums ACF PRO Google Maps into Taxonomies Reply To: Google Maps into Taxonomies

  • Hello John,

    thanks so far, but how does it work if I use taxonomies created with CPT UI plugin?
    Also, I don’t want to show the taxonomy in the post. It should work under the hood. Will I need another fieldset?

    Right now I am a little confused 😊

    With your help I made it this far. But/where can I find the Term ids?

    function my_copy_date_filter( $post_id ) {
    	$post_type = get_post_type( $post_id );
    	if ( $post_type != 'spot' ) {
    		return;
    	}
    	$location = get_field( 'spot_location', $post_id );
    	if( $location[ 'lat' ] && $location[ 'lng' ] ) {
    		update_field( 'spot_coordinates', $location[ 'lat' ].','.$location[ 'lng' ], $post_id );	
    	}
    	if( $location[ 'state' ] ) {
    		update_field( 'spot_bundesland', $location[ 'state' ], 'term_'.$term_id );
    	}
    	if( $location[ 'city' ] ) {
    		update_field( 'spot_stadt', $location[ 'city' ], 'term_'.$term_id );	
    	}
    	if( $location[ 'address' ] ) {
    		update_field( 'spot_address', $location[ 'address' ], $post_id );	
    	}
    }
    add_filter( 'acf/save_post', 'my_copy_date_filter', 20 );

    Greetings from Cologne,
    Denis