Allow customization of facet widget query parameters #1198
Description
Have you searched for similar issues before submitting this one?
Yes
Is this a bug, question or feature request?
Feature
Describe the issue you encountered:
Our search result page has links that allow users to change the sort order, and to limit the results to a single post type. These links go to URLs with query parameters like ?post_type=page&orderby=date&s=hello
. When we add the facet widget, the terms in the widget are linked to URLs with query parameters like ?s=hello&filter_foo=bar
. The post_type
and orderby
params are not retained, so the post type limitation and sort order are lost when the user clicks on a facet term. We want these to be maintained.
I would propose adding a filter that could be applied here:
ElasticPress/features/facets/facets.php
Lines 429 to 453 in b2f77c7
So at line 451, something like:
$query_string = apply_filters( 'ep_facet_query_string', $query_string );
Happy to make a pull request for this.
Activity