Skip to content

Instantly share code, notes, and snippets.

@LaxusCroco
Created November 21, 2023 10:50
Show Gist options
  • Save LaxusCroco/dae76a0cec6830eb029e280d9325a386 to your computer and use it in GitHub Desktop.
Save LaxusCroco/dae76a0cec6830eb029e280d9325a386 to your computer and use it in GitHub Desktop.
Insert '_search_by_term_name' into the Query Variable of the Search Filter to search the taxonomy listing by term names. Apply a Terms Query to the listing
<?php
add_filter( 'jet-smart-filters/query/final-query', function($query){
if( isset( $query['meta_query'] ) ){
foreach( $query['meta_query'] as $item => $value){
if( $value['key'] === '_search_by_term_name' ){
$query['search'] = $value['value'];
unset($query['meta_query'][$item]);
}
}
}
return $query;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment