Created
November 21, 2023 10:50
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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