Advanced Custom Fields
ACF only show item with a valid element (1 post)

  1. rocketcoindexter
    Posted 2 years ago #

    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.


Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Advanced Custom Fields
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic