/facet/query_objects
This filter is called before a facet queries object ids (post ids, term ids or user ids) from selected facet value(s).
It allows to override the behaviour of the native query_objects
method of the facet and to pass custom object ids in order to change the filtered content.
Argument | Type | Description |
$object_ids | mixed | Array of object IDs (false by default) |
$facet | array | Holds facet settings |
[pastacode lang=”php” manual=”function%20prefix_query_objects(%20%24object_ids%2C%20%24facet%20)%20%7B%0A%0A%09%2F%2F%20If%20it%20matches%20facet%20id%201%2C%20we%20set%20a%20custom%20set%20of%20post%20ids.%20%0A%09if%20(%201%20%3D%3D%3D%20%24facet%5B’id’%5D%20)%20%7B%20%0A%09%09%24object_ids%20%3D%20%5B%201%2C%2020%2C%2034%2C%20105%20%5D%3B%0A%09%7D%20%0A%0A%0A%09%2F%2F%20If%20it%20matches%20facet%20id%202%2C%20we%20make%20a%20custom%20query%20from%20selected%20facet%20values.%20%0A%09if%20(%202%20%3D%3D%3D%20%24facet%5B’id’%5D%20)%20%7B%20%0A%09%09%24object_ids%20%3D%20my_custom_query(%20%24facet%5B’selected’%5D%20)%3B%20%0A%09%7D%20%0A%0A%0A%0A%09%2F%2F%20Return%20false%20by%20default.%20%0A%09return%20%24object_ids%3B%0A%09%0A%7D%0A%0Aadd_filter(%20’wp_grid_builder%2Ffacet%2Fquery_objects’%2C%20’prefix_query_objects’%2C%2010%2C%202%20)%3B” message=”” highlight=”” provider=”manual”/]