How to filter results by categories in Wordpress

I’m using the Wordpress plugin and would like to filter the results displayed by the Auto-Complete and the actual search to certain categories depending on what page the search widget is on.

For example, we have a list of teachings. If someone searches on that page I’d like it to only show results with the ‘teachings’ category.

How can this be done?

Thank you

1 Like

Hi @ronnie,

To be transparent, this is currently not an easy task.
You would need to override bother autocomplete and instantsearch templates like explained in the following guides:

Then you need to pass the current category name to javascript from your backend and use it to filter autocomplete.js and instantsearch.js.

Documentation of those 2 libraries can be found here:

An alternative solution would be to create your custom frontend search from scratch by using the library from your choice.

If you are moving forward with this, please feel free to open specific topics regarding issues you might have.