Programatically adding filters
Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Programatically adding filters
- This topic has 1 reply, 2 voices, and was last updated 7 months ago by
Ernest Marcinko.
-
AuthorPosts
-
December 18, 2025 at 1:34 pm #56599
milena_u6jm
ParticipantHey Ernest & team.
I would like some guidance on the best practices for setting up some custom filters. If you could help us with some basic structures of how to best achieve what what need, that would be super helpful.
Index:
Our index is of all media items, but filtered to only index items with an ACF value of true for a field called available, you have helped set this up with another ticket. I am indexing all the ACF fileds that we need for the following filters. These fields are:
– artistID
– price
– size_height
– size_widthFilters:
We have to create 3 filters programatically, as they are custom, but if theres a way to do them another way, please let me know. I have hacked together some of them with LLM code, but I would rather build from scratch with your help.I noticed that if I didnt add and hide at least one filter in the UI, these new ones wouldnt show at all, so we do this, but seems clunky?
Filter 1 – Artist name (kinda working but hacky)
– each artwork should have an ACF artist_id field
– we need to collate the artist list that has available works list, build a checkbox list, and then filter to just show artworks available from that artistFilter 2 – Price range (kinda working but hacky)
– each artwork has a price, and we have a preset list of price ranges to limit results to certain rangesFilter 3 – Size
– each artwork has a height and width
– we want to have two range sliders where someone can set the min/max size, and then click to apply the filter to the resultsIf you could offer some help in getting these set up a proper way, that would be amazing.
Thanks everyone.
December 20, 2025 at 10:36 am #56616Ernest Marcinko
KeymasterHi!
Well, these are indeed very specific, but it entirely depends on how these are implemented.
I recommend looking at the frontend filters API. That contains information on how to add/alter filters on the search settings list.
-
AuthorPosts
- You must be logged in to reply to this topic.