Skip to content

Instantly share code, notes, and snippets.

@nickpish
Created August 18, 2022 02:30
Show Gist options
  • Save nickpish/5c6997977506dbe7799b2911da1ee5b8 to your computer and use it in GitHub Desktop.
Save nickpish/5c6997977506dbe7799b2911da1ee5b8 to your computer and use it in GitHub Desktop.
FacetWP map facet: Get location from College taxonomy custom location field
add_filter( 'facetwp_index_row', function( $params, $class ) {
if ( 'college_map' == $params['facet_name'] ) {
$term_id = (int) $params['term_id'];
$location = get_term_meta( $term_id, 'location', true );
$params['facet_value'] = empty( $location ) ? '' : $location['lat'];
$params['facet_display_value'] = empty( $location ) ? '' : $location['lng'];
}
return $params;
}, 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment