I have 3 custom post types with Advanced Custom Fields:
- Student
- Class
- Homework Assignment
Homework has a custom field that is a ‘relationship’ with Class. This is because specific pieces of homework are related to specific classes.
A Student has a relationship field with Class because each student is part of a class.
Now I want to create a Homework Assignment, so I set a custom field (relationship) of student. Once I’ve chosen a student, I want the 2nd custom field (also a relationship) to give me the choice of any Homework Assignment records that have the same class as the student.
So basically how do I have a conditional statement with Advanced Custom Fields that ‘filters’ instead of ‘show/hides’ the 2nd custom field?
Maybe you’re using the wrong tool to represent relations between posts. the custom post meta fields api is somehow inefficient for that task and has certain restrictions.
I advice to have a look at the “posts to posts” plugin from pipin which is much more suited for that task.