"Filter: bricks/combined_search/term_ids"
فهرست شناسههای عبارت بازگردانده شده توسط منطق جستجوی ترکیبی را فیلتر میکند (در فیلترهای جستجوی AJAX استفاده میشود که عبارات را هدف قرار میدهند). این به شما این امکان را میدهد که پس از اجرای عبارت جستجوی اولیه، عبارتها را از نتایج جستجو اضافه یا حذف کنید.
پارامترها
$term_ids(array): Array of found term IDs.$term_fields(array): Array of term fields being searched (e.g.,['name', 'slug']).$meta_fields(array): Array of meta keys being searched.$search_term(string): The search term entered by the user.$filter_id(string): The ID of the filter element initiating the search.$query_id(string): The ID of the query loop being filtered.
نمونه استفاده
add_filter( 'bricks/combined_search/term_ids', function( $term_ids, $term_fields, $meta_fields, $search_term, $filter_id, $query_id ) {
// Example: Exclude 'uncategorized' term (ID: 1) from search results
if ( ( $key = array_search( 1, $term_ids ) ) !== false ) {
unset( $term_ids[ $key ] );
}
return $term_ids;
}, 10, 6 );