Home Forums General Issues Select post in relationship only once


Select post in relationship only once

  • Hi,

    For example, I have Teams and Players CPT. I created relationship between the two, so when visiting team A, there is a list of all players and one can be add as needed to this particular team. However, when visiting team B, the players that were selected to team A can be selected to team B.

    So, is it possible to prevent that in any way?

    Thank you!

  • You would need to create an acf/fields/relationship/query filter.

    In this filter you would need to do gather al list of all of of the players already selected for other teams. To do this you would need to do a query to get all of the teams and then get the players field from each post and make a list of post IDs in an array. They you would use these results in the “post__not_in” argument for the query.

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

You must be logged in to reply to this topic.