Hello,
I’m trying to restrict the listing search results on the “services” page to only show listings that are either “featured” or “verified”.
Here is what I have already tried:
- Added a custom attribute called “verified” to listings via HivePress Attributes.
- Verified that the attribute is working properly (I can filter by it manually on the search page).
- Tried using
add_filter('hivepress/v1/models/listing/query', ...)
but it seems not to affect the listings loaded on the services page. - Tried using
add_filter('hivepress/v1/rest/listing/search', ...)
but it also does not seem to trigger (no alert or change detected). - I confirmed that the services page loads listings via REST API (Ajax after initial page load).
Questions:
- What is the correct method to forcibly filter listings to only “featured” or “verified” when loading search results on the services page?
- Are there multiple approaches to solve this? (e.g., hook/filter, custom REST handler, template override, etc.)
- What is the recommended approach by HivePress for production-level sites aiming for high security and stable operations?
I want to make sure that unverified or non-featured listings are never shown to users.
Thank you in advance for your guidance!