Forums › Forums › Search & Filter Pro › Need to display labels in filter for a dynamically populated ACF dropdown
- This topic has 1 reply, 2 voices, and was last updated 10 years, 7 months ago by
Ross.
-
Anonymous(Private) April 7, 2016 at 12:11 am #41869
Hi,
I have a multiselect Advanced Custom Fields dropdown in my form, which is populated dynamically using a mix of AJAX and PHP. Basically it’s populated from the user’s selection in a dropdown above it.I’d like to filter search results by the values in this dynamically populated dropdown. However, within my posts, the dropdown selections are saved in the db as ids, instead of their labels. In order to display the names on my blog, I use ACF’s “get_field_object” method, then can retrieve the label by accessing the object’s [‘choices’] array. However, in the filter, it only shows ids, and I need the user to be able to see the label so that he/she knows what they’re filtering on.
Since the dropdown is populated dynamically, the label is not automatically pulled in from the ACF field. Is there another way I can get the label to display if I only have the value stored in my database? Please let me know, as this might be a blocker. Thanks!!
Ross Moderator(Private) April 7, 2016 at 12:17 am #41871Hi Tina
I think you may be using a relationship field?
S&F provides a filter for every field (like ACF) so you can change the options/labels in that field:
I think this user was looking for the same functionality:
https://support.searchandfilter.com/forums/topic/filter-dropdown-options/#post-34366Thanks
-
AuthorPosts