Filter DELETE REST API calls

Question

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?

0
CaptainNemo 4 months 0 Answers 8 views 0

Leave an answer