/facet/search_query_args
This filter is called before the search facet query object ids (posts, terms, users).
It allows to modifies the search query arguments made by WP_Query
, WP_Term_Query
or WP_User_Query
Argument | Type | Description |
$query | array | Holds search query args |
$facet | array | Holds facet settings |
[pastacode lang=”php” manual=”function%20prefix_search_query_args(%20%24query_args%2C%20%24facet%20)%20%7B%0A%0A%0A%09%2F%2F%20We%20exclude%20post%20IDs%20from%20search%20if%20facet%20ID%20is%20equal%20to%201.%0A%09if%20(%201%20%3D%3D%3D%20%24facet%5B’id’%5D%20)%20%7B%0A%09%09%24query_args%5B’post__not_in’%5D%20%3D%20%5B%201%2C%202%2C%203%2C%204%20%5D%3B%0A%09%7D%0A%09%0A%09return%20%24query_args%3B%0A%09%0A%7D%0A%0Aadd_filter(%20’wp_grid_builder%2Ffacet%2Fsearch_query_args’%2C%20’prefix_search_query_args’%2C%2010%2C%202%20)%3B” message=”” highlight=”” provider=”manual”/]