ACF only show item with a valid element
I have an ACF for city, and the array has the top 50 major us cities in it. This is stored and set in ACF > City >Choices
I then have it called on the front end by the Field Key, and it loads in a drop down.
However, I would like the dropdown list to be occupied by cities that have a post associated it to it.
For example, New York has 7 posts associated to it, and Delaware has 0. So in the drop down 0 should not show up.
I am using the following on the front end
$city = get_post_meta(35, ‘field_xxxxxxxx’, true);
and help or guidance woul dbe greatly appreciated.
- The topic ‘ACF only show item with a valid element’ is closed to new replies.