Title: Role can&#039;t delete post
Last modified: August 31, 2016

---

# Role can't delete post

 *  [mchapela](https://wordpress.org/support/users/mchapela/)
 * (@mchapela)
 * [9 years, 12 months ago](https://wordpress.org/support/topic/role-cant-delete-post/)
 * Hi,
 * I have added a role in my functions php just like this.
 *     ```
       $result = add_role( 'traveler', __(
                   'Traveler' ),
                   array(
   
                       'read' => true,
                       'edit_posts' => true,
                       'edit_pages' => false,
                       'edit_others_posts' => false,
                       'delete_published_posts' => true,
                       'delete_posts'=> true,
                       'edit_published_posts'=>true,
                       'create_posts' => true,
                       'manage_categories' => true,
                       'publish_posts' => true, 
   
                       )
   
       );
       ```
   
 * And in a custom post type I display on the frontend a link to delete the post
   with the `function get_delete_post_link( )`.
 * This works link works fine for me as an administrator, or for an user with author
   role, but not for users with traveler role. So I guess there is a capabilitie
   missing there, but travelers aleready have the same capabilities than a author…
   What is wrong?
 * Thanks

Viewing 5 replies - 1 through 5 (of 5 total)

 *  [Clarion Technologies](https://wordpress.org/support/users/clarionwpdeveloper/)
 * (@clarionwpdeveloper)
 * [9 years, 12 months ago](https://wordpress.org/support/topic/role-cant-delete-post/#post-7413178)
 * You need to use and activate **User Role Editor** wordpress plugin
    [https://wordpress.org/plugins/user-role-editor/](https://wordpress.org/plugins/user-role-editor/).
   Once you activated ,Log into wordpress admin dashboard, where in left side admin
   menu there is “User Role Editor” menu present below the “USER” menu ,from where
   you need edit capabilities of role “traveler” and need to assign with delete_posts
   and delete_other_posts capabilities to role “traveler”.
 *  Thread Starter [mchapela](https://wordpress.org/support/users/mchapela/)
 * (@mchapela)
 * [9 years, 12 months ago](https://wordpress.org/support/topic/role-cant-delete-post/#post-7413196)
 * I tried doing that, but didn’t work. Also I added the capabilitie delete_other_posts
   to the role traveler in my functions.php but doesn’t work…
 *  [Clarion Technologies](https://wordpress.org/support/users/clarionwpdeveloper/)
 * (@clarionwpdeveloper)
 * [9 years, 12 months ago](https://wordpress.org/support/topic/role-cant-delete-post/#post-7413200)
 * you need to add capabilities delete_other_posts using above plugin.
    As below
   code not going to update previously added capabilities $result = add_role( ‘traveler’,
   __( ‘Traveler’ ), array(
 *  ‘read’ => true,
    ‘edit_posts’ => true, ‘edit_pages’ => false, ‘edit_others_posts’
   => false, ‘delete_published_posts’ => true, ‘delete_posts’=> true, ‘edit_published_posts’
   =>true, ‘create_posts’ => true, ‘manage_categories’ => true, ‘publish_posts’ 
   => true,
 *  )
 * );
 *  Thread Starter [mchapela](https://wordpress.org/support/users/mchapela/)
 * (@mchapela)
 * [9 years, 12 months ago](https://wordpress.org/support/topic/role-cant-delete-post/#post-7413204)
 * I did both using the plugin and adding code in functions.php
 *  [Clarion Technologies](https://wordpress.org/support/users/clarionwpdeveloper/)
 * (@clarionwpdeveloper)
 * [9 years, 12 months ago](https://wordpress.org/support/topic/role-cant-delete-post/#post-7413207)
 * Using below capabilities for user traveler, set using User Role Editor Plugin:
   
   delete_others_posts delete_posts delete_published_posts edit_posts edit_published_posts
   manage_categories publish_posts read
 *  I can delete post using
    get_delete_post_link($pid) function
 * below are my sampel code that I have used for testing:
 *     ```
       while ( have_posts() ) : the_post();
       $pid=get_the_ID();
   
       echo '<a href="'.get_delete_post_link($pid).'">Delete Post</a>';
   
       endwhile;
       ```
   

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Role can't delete post’ is closed to new replies.

## Tags

 * [delete](https://wordpress.org/support/topic-tag/delete/)
 * [post](https://wordpress.org/support/topic-tag/post/)
 * [role](https://wordpress.org/support/topic-tag/role/)
 * [user](https://wordpress.org/support/topic-tag/user/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 5 replies
 * 2 participants
 * Last reply from: [Clarion Technologies](https://wordpress.org/support/users/clarionwpdeveloper/)
 * Last activity: [9 years, 12 months ago](https://wordpress.org/support/topic/role-cant-delete-post/#post-7413207)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
