[wp-trac] [WordPress Trac] #31034: delete_post capability issue in Trash

WordPress Trac noreply at wordpress.org
Fri Jan 16 07:36:05 UTC 2015


#31034: delete_post capability issue in Trash
-----------------------------+-----------------------------
 Reporter:  szaqal21         |      Owner:
     Type:  defect (bug)     |     Status:  new
 Priority:  normal           |  Milestone:  Awaiting Review
Component:  Role/Capability  |    Version:  4.1
 Severity:  normal           |   Keywords:
  Focuses:                   |
-----------------------------+-----------------------------
 There is a issue with capability 'delete_post' in Trash when a post with
 status other than 'publish' was trashed. When you registered this post
 type with map_meta_cap => true and disabled capability 'delete_post' using
 'user_has_cap' you will see that in posts (view All) table there is no
 trash link in post row actions but you can select this post and bulk
 remove. Post will be moved to trash and voila in view Trash you can
 permanently remove this post.

 I've checked the source and found that te problem is map_meta_cap()
 function

 {{{
 } elseif ( 'trash' == $post->post_status ) {
                                 if ( 'publish' == get_post_meta(
 $post->ID, '_wp_trash_meta_status', true ) ) {
                                         $caps[] =
 $post_type->cap->delete_published_posts;
                                 }
                         }
 }}}
 there is a check for 'publish' status so when my post was 'pending'
 map_meta_cap() returned empty array().

--
Ticket URL: <https://core.trac.wordpress.org/ticket/31034>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list