Hello everybody,
I found this
Display location address details
This is real cool.
Now I try to extract information and put it directly into my taxonomy LOCATION and CITY.
But how do I put the info $location[ ‘city’ ] and $location[ ‘state’ ] into the Taxonomies.
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_lat_lng', $location[ 'lat' ].','.$location[ 'lng' ], $post_id );
}
if( $location[ 'state' ] ) {
update_field( 'new_spot_state', $location[ 'state' ], $post_id );
}
if( $location[ 'city' ] ) {
update_field( 'new_spot_city', $location[ 'city' ], $post_id );
}
// HOW CAN I PUT $location[ 'city' ] and $location[ 'state' ] into taxonomy
}
add_filter( 'acf/save_post', 'my_copy_date_filter', 20 );
Any suggestion?
Thanks in advance,
Denis