Skip to content

Instantly share code, notes, and snippets.

@pbearne
Created November 3, 2025 21:23
Show Gist options
  • Select an option

  • Save pbearne/476efa26569949462c07fb5b8ac9892f to your computer and use it in GitHub Desktop.

Select an option

Save pbearne/476efa26569949462c07fb5b8ac9892f to your computer and use it in GitHub Desktop.
filter Shortcode to exclude term
add_action( 'matador_jobs_query_jobs_args', 'exclude_tax_term_from_shortcode', 10, 2 );
function exclude_tax_term_from_shortcode( $query, $args ) {
if( $args['matador-category'] !== 'internal' ){
if ( ! empty( $query['tax_query'] ) && count( $query['tax_query'] ) > 1 ) {
$query['tax_query']['relation'] = apply_filters( 'matador_jobs_listing_query_taxonomy_relation', 'AND' );
}
$query['tax_query'][] = array(
'taxonomy' => 'matador-category',
'field' => 'slug',
'terms' => array('internal'),
'operator' => 'NOT IN'
);
}
return $query;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment