<?php
/**
* 1. Add to your (child) theme's functions.php
* 2. Assumes a facet named "doctor_location" w/ an ACF relationship field data source
* 3. Assumes that the ACF Map field name is "location"
*/
add_filter( 'facetwp_index_row', function( $params, $class ) {
if ( 'doctor_location' == $params['facet_name'] ) {
$location_id = (int) $params['facet_value'];
$location = get_field( 'location', $location_id );
$params['facet_value'] = empty( $location ) ? '' : $location['lat'];
$params['facet_display_value'] = empty( $location ) ? '' : $location['lng'];
}
return $params;
}, 10, 2 );