Skip to content

Instantly share code, notes, and snippets.

@mgibbs189
Last active August 16, 2019 17:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mgibbs189/931284a124cf5765427ba49707a2edcb to your computer and use it in GitHub Desktop.
Save mgibbs189/931284a124cf5765427ba49707a2edcb to your computer and use it in GitHub Desktop.
<?php
add_filter( 'facetwp_indexer_row_data', function( $rows, $params ) {
if ( 'locations' == $params['facet']['name'] ) {
$post_id = (int) $params['defaults']['post_id'];
$location = get_field( 'locations', $post_id ); // returns an post object
$field_value = get_field( 'postcode', $location->ID );
$new_row = $params['defaults'];
$new_row['facet_value'] = $field_value; // value
$new_row['facet_display_value'] = $field_value; // label
$rows[] = $new_row;
}
return $rows;
}, 10, 2 );
@getmehire
Copy link

LOL please solve my issue too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment