Support

Account

Home Forums General Issues Filter relationship field values conditionally

Helping

Filter relationship field values conditionally

  • Hi Elliot

    Just wanted to check if you’ve already answered this question elsewhere (I haven’t been able to find anything) or if you could kindly point me in the right direction.

    I’ve got a bunch of relationship fields – Region, City, Suburb. Is there a hook or filter I can use to make them filter conditionally? E.g. only certain cities will be available to the user for selection based on the region that was selected?

    Thanks man.

  • Hi @patternbook

    It is possible to customize the WP_Query args by using this filter:
    http://www.advancedcustomfields.com/resources/filters/acf-fields-relationship-query/

    However, because this is a PHP filter, there would be no way of knowing the ‘new’ region value selected on the same page, only the region value that was already saved to the DB.

    Hope that helps.

    Thanks
    E

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

The topic ‘Filter relationship field values conditionally’ is closed to new replies.