FacetWP – set ACF relationship facet value to the post’s slug instead of ID

mgibbs189

{{gist file=”functions.php” lang=”php”}}
<?php

add_filter( ‘facetwp_index_row’, function( $params, $class ) {
if ( ‘job_company’ == $params[‘facet_name’] ) {
if ( ! empty( $params[‘facet_value’] ) ) {
$post = get_post( (int) $params[‘facet_value’] );
$params[‘facet_value’] = $post->post_name;
}
}
return $params;
}, 10, 2 );

{{/gist}}