Support

Account

Home Forums ACF PRO Two dependant CPT, need help

Helping

Two dependant CPT, need help

  • Lets assume the following: fir a band website I try to create a gig calendar. Therefor i created two custom post types, named as locations and events. In the events post edit, i have a field that contains all locations.

    What i try to achieve now, is the following: create a new event only if at least one location exists, otherwise print out a notice.

    Could someone help me out with that? Thanks in advance and greetings from Germany

  • Hi @sixtyseven,

    Thanks for the post.

    In this use case, I would recommend you make use of the acf/validate_value filter to check if the location exists. You will need to create some logic to query the values in the locations fields and compare them with the entered value.

    If the entered value fails validation then an error message will be printed out and prevent the post from saving.

    Here is a link to showcase this filter: https://www.advancedcustomfields.com/resources/acf-validate_value/

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

The topic ‘Two dependant CPT, need help’ is closed to new replies.