Delete custom post type from frontend registered user
-
Hello everybody
I am using your plugin to create a private area for registered users. I created a form (with cf7) for posting (in a Custom post type) from the frontend only for registered users . Everything works, but if I want to allow the single registered user to delete his posts from the frontend I am obliged to set “delete_users” among the capabilities of his role. Without it cannot erase. The problem is that if this ability is enabled, the user has access to the backend even if the check in the role settings has not been checked.
This is the function I use to delete from the frontend:// Delete post function delete_post(){ global $post; $deletepostlink= add_query_arg( 'frontend', 'true', get_delete_post_link( get_the_ID() ) ); if (current_user_can('edit_post', $post->ID)) { echo '<a class="btn btn-sm text-primary" data-bs-toggle="tooltip" title="Löschen" onclick="return confirm(\'Sind Sie sicher dieses Item zu löschen?\')" href="'.$deletepostlink.'">'.iconTrash("w-5 h-5").'</a>'; } }
Is it possible to allow registered users to delete their own posts without using the “delete_users” ability and without being able to enter the backend?
Thank you
- The topic ‘Delete custom post type from frontend registered user’ is closed to new replies.