I have an advanced custom fields field called job_type. It is a select type field so it has a number of values in the field like Contract, Freelance, Permanent etc. So I list all the jobs on a page and now I want to have exposed filters on the left where a user can choose to filter the jobs based on various fields. So for example if he chooses Freelance the page should (with ajax) show only the jobs that are of type 'Freelance'
How do I get the values from the field into a select list please?
I have an advanced custom fields field called job_type. It is a select type field so it has a number of values in the field like Contract, Freelance, Permanent etc. So I list all the jobs on a page and now I want to have exposed filters on the left where a user can choose to filter the jobs based on various fields. So for example if he chooses Freelance the page should (with ajax) show only the jobs that are of type 'Freelance'
How do I get the values from the field into a select list please?
Share Improve this question edited Jul 14, 2020 at 6:54 calvincani asked Jul 14, 2020 at 6:41 calvincanicalvincani 1011 bronze badge1 Answer
Reset to default 0If you mean an ACF select field:
<?php
$field = get_field_object('my_select');
var_dump( $field['choices'] );
?>
More info here https://www.advancedcustomfields/resources/get_field_object/