Support Forums

The forums are closed and will be removed when we launch our new site.

Looking for support? You can access the support system via your account.

Forums Forums Search & Filter Pro Need to display labels in filter for a dynamically populated ACF dropdown

Viewing 2 posts - 1 through 2 (of 2 total)
  • Grosvenor
    #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
    #41871

    Hi 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:

    http://www.designsandcode.com/documentation/search-filter-pro/action-filter-reference/#Filter_Input_Object

    I think this user was looking for the same functionality:
    https://support.searchandfilter.com/forums/topic/filter-dropdown-options/#post-34366

    Thanks

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Need to display labels in filter for a dynamically populated ACF dropdown’ is closed to new replies.