I’m using advanced custom fields for a select field on User profiles. There are hundreds of options, but only a few are truly used by Users. Is there a way to make a Frontend Filter that can prepopulate only the used options of my custom field? As opposed to using {all_values} which is hundreds of options? Thanks for your help!
I’m afraid no, because there is no efficient way to check which ones are in use. When using the {get_values} statement, the plugin checks which ones are within the post meta table, and prints them. Checking them against the profiles for existence could get exponentially hard (as subqueries would have to be implemented) and may cause huge performance issues.
Ok thanks for the response. I have a separate question then:
I’m using the live search with frontend filters, and a custom vertical.php for the search results. I’m currently using ACF in the search results, but I’d like to show 1 of 2 ACF field values depending on one of the frontend filters. I’m unsure how I can access the current search variables from vertical.php. I’m not seeing anything in s_options that would help. Any ideas?
The query arguments are not passed to that file unfortunately, but there might be a way.
You could try using the asp_results filters to change the result field according to your needs and print it in the template file. The $args variable contains the generated custom field filters as well.