Skip to content

Instantly share code, notes, and snippets.

@tripflex
Created November 21, 2022 22:49
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 tripflex/d0a9cc4e9b99db0121f8ed9e01473594 to your computer and use it in GitHub Desktop.
Save tripflex/d0a9cc4e9b99db0121f8ed9e01473594 to your computer and use it in GitHub Desktop.
Hide child terms for specific taxonomy when using Search and Filtering (requires 1.1.29 or newer)
<?php
add_filter( 'search_and_filtering_get_taxonomy_data_options_include_child_terms', 'smyles_tax_child_terms', 10, 2 );
function smyles_tax_child_terms( $args, $taxonomy ){
if( $taxonomy === 'job_listing_category' ){
return false;
}
return $args;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment