Custom map_meta_cap filter does not return [‘do_not_allow’]
I don’t know how to make it restrict access correctly. Try this, which uses get_post_ancestors(): function staby_cap_filter( $allcaps, $cap, $args, $user ) { // Get the current user’s roles. $roles = (array) $user->roles; /* Do nothing if: 1. The above roles doesn’t include ‘test’, or 2. edit_post is not the capability being checked, or 3. … Read more