You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your enhancement related to a problem? Please describe.
Currently there is no way to filter an Autosuggest query conditionally based on the input or form that triggered it, meaning that it's not possible for Autosuggest to reflect any additional fields in the form beyond a post_type field which is natively supported.
Describe the solution you'd like
We could add a 'filter', a la the epAutosuggestItemHTMLFilter filter for Autosuggest items, to allow modifying the JSON for the Elasticsearch query before it is sent. If this filter received the triggering input as a parameter then it could be used to modify the query as needed based on the search form.
Additionally, it might be worth examining the feasibility of implementing @wordpress/hooks for proper actions and filters, instead of a window property that can only be set once. The main consideration would be whether or not it is too large for regular front-end use.
Describe alternatives you've considered
The query template could be filtered by using pre_get_posts and checking if the s argument is set to the placeholder, but this would apply globally to all Autosuggest instances and would not be modifiable based on form values.
The text was updated successfully, but these errors were encountered:
Is your enhancement related to a problem? Please describe.
Currently there is no way to filter an Autosuggest query conditionally based on the input or form that triggered it, meaning that it's not possible for Autosuggest to reflect any additional fields in the form beyond a
post_type
field which is natively supported.Describe the solution you'd like
We could add a 'filter', a la the
epAutosuggestItemHTMLFilter
filter for Autosuggest items, to allow modifying the JSON for the Elasticsearch query before it is sent. If this filter received the triggering input as a parameter then it could be used to modify the query as needed based on the search form.Additionally, it might be worth examining the feasibility of implementing @wordpress/hooks for proper actions and filters, instead of a window property that can only be set once. The main consideration would be whether or not it is too large for regular front-end use.
Describe alternatives you've considered
The query template could be filtered by using
pre_get_posts
and checking if thes
argument is set to the placeholder, but this would apply globally to all Autosuggest instances and would not be modifiable based on form values.The text was updated successfully, but these errors were encountered: