Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save propertyhive/59f7876e1cc9ed740636f9ef8ace2926 to your computer and use it in GitHub Desktop.
Save propertyhive/59f7876e1cc9ed740636f9ef8ace2926 to your computer and use it in GitHub Desktop.
add_filter( 'propertyhive_taxonomy_hide_empty_args', function( $args, $field, $term_id ) {
if ($field['type'] == 'location')
{
// Make sure 'tax_query' exists
if ( !isset( $args['tax_query'] ) ) {
$args['tax_query'] = array();
}
// Add condition to exclude properties where 'availability' taxonomy term is 'Sold'
$args['tax_query'][] = array(
'taxonomy' => 'availability',
'field' => 'slug',
'terms' => array( 'sold' ),
'operator' => 'NOT IN',
);
}
return $args;
}, 10, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment