Hello,
I have 2 customs post type : “courses” and “instructors”
Each course can have one or more instructors (via Relationship field)
Now in bakcoffice, i have :
Owner school1 can add his instructors : instructor1, instructor2
Owner school2 can add his instructors : instructor3, instructor4, instructor5
How to let each Owner school to see ONLY THEIR OWN instructors in the relationship field ?
Thank you
Hello,
This worked well for me !
function my_relationship_query( $args, $field, $post ) {
// get posts for current logged in user
$args['author'] = get_current_user_id();
return $args;
}
add_filter('acf/fields/relationship/query/name=instructors', 'my_relationship_query', 10, 3);
Thank you