Support

Account

Home Forums Add-ons Options Page How to disallow a selected field if selected in a previous post

Helping

How to disallow a selected field if selected in a previous post

  • I Have a custom post named Player and you can capture name, address, etc. It appears in another custom post named Teams via a repeater field using a post relationship.

    That way you can select in a team different players.

    What we like to do is if you have selected a player in a previous team, not allowing to select it in a different team.

    If you have team a with selected players: John and Steve if you create a new team, don’t be allowed to select this players from the list.

  • Hi @designerfree

    This is a bit of a tricky one, but is possible using a filter on the relationship query.

    Check out the docs page (http://www.advancedcustomfields.com/resources/tutorials/customize-the-relationship-field-list-query/) and you will find code to alter the results available in the relationship list.

    You will need to use this filter to add an exclude argument to the $args. Please research the WP_Query args before doing this.

    As for finding the ID’s to exclude, I’m not sure how you will do this.

    Good luck

    Thanks
    E

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

The topic ‘How to disallow a selected field if selected in a previous post’ is closed to new replies.