I have a custom post type, that can be editable by more than one user. Each post of that type has a field with the user ids who can edit it (kinda like co-authors). But since many users have permissions to the post, I am not sure how to prevent deletion by other users (not in the co-authors' list).
Right now the problem is only present in the REST API which is used to delete from the frontend.
Is there a pre delete hook in which I can check for permissions and block the deletion if the user is not allowed to delete that specific post?
pre_delete_post
hook? developer.wordpress.org/reference/hooks/pre_delete_post