Search: Using visibility with widget causes filters to not load
While testing on the Independent Publisher theme, I noticed that when I set the search widget to only show on the blog page or the search page, that the filters don't get loaded. 😞
To reproduce:
- Ensure you have a Jetpack site with a professional plan
- I imagine it's the same issue for other themes, but perhaps start with the theme above
- Add search widget with filters. Make sure visibility options are not set
- Perform a search on the frontend and ensure filters are returned
- Add visibility options
- Observe that filters don't show
I noticed that when visibility is set, and the filters don't show, that we didn't add aggregations to the search query. So, I'd assume that the issue is in how we load the aggregations from the widget option.
Also reported in 1076711-zen theme: customized Genesis theme
I verified that this setup for visibility works fine to allow the widget and its filters to be displayed in, for example, a posts page and the search results.
This is the expected behavior of visibility so I'll close this for now.
Thanks for testing and closing @eliorivero. It's been quite a while since I reported, but I imagine that I was probably doing something like setting "page is posts page" by itself. Now I understand that "page is search results" also needs to be set.
I've tested again and it seems to work as expected. 👍