ElasticPress icon indicating copy to clipboard operation
ElasticPress copied to clipboard

Autosuggest V2

Open ZacharyRener opened this issue 7 months ago • 0 comments

Description of the Change

New Feature: Autosuggest V2 This uses the Post Search API and filterable React components. By default it matches the appearance of Autosuggest V1:

Available PHP hooks:

  • ep_autosuggest_v2_per_page - Modify count of results returned

Available JS hooks:

  • ep.Autosuggest.queryParams - Modify search query parameters
  • ep.Autosuggest.suggestions - Filter search results
  • ep.Autosuggest.suggestionItem - Customize individual suggestion item rendering
  • ep.Autosuggest.suggestionList - Customize suggestion list rendering
  • ep.Autosuggest.onItemClick - Triggered when a suggestion item is clicked

Available Events:

  • ep_autosuggest_loaded - window.EPAutosuggest is available - safe to hook into ui overrides

More information on the hooks is available in the autosuggest-v2 readme

Here's the result of some child theme hook customizations:

How to test the Change

  • Enable the feature in ElasticPress
  • Confirm the appearance is identical to Autosuggest V1
  • (If desired) In your theme or from another plugin, add and test out some hooks. Reference autosuggest-v2's readme.md for premade hooks.

Changelog Entry

Added - New feature: Autosuggest V2

Credits

Props @ZacharyRener

Checklist:

ZacharyRener avatar May 21 '25 22:05 ZacharyRener