Last active
August 16, 2019 17:09
-
-
Save mgibbs189/931284a124cf5765427ba49707a2edcb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
LOL please solve my issue too.