[wp-trac] [WordPress Trac] #19834: More Robust Capabilities for Attachments

WordPress Trac noreply at wordpress.org
Thu May 16 11:11:06 UTC 2019


#19834: More Robust Capabilities for Attachments
-----------------------------+------------------------------
 Reporter:  walkinonwat3r    |       Owner:  (none)
     Type:  feature request  |      Status:  new
 Priority:  normal           |   Milestone:  Awaiting Review
Component:  Media            |     Version:
 Severity:  normal           |  Resolution:
 Keywords:                   |     Focuses:
-----------------------------+------------------------------

Comment (by grapplerulrich):

 In the meantime, this may be a better way in doing it instead of using the
 global.

 {{{#!php
 add_action( 'admin_init', function() {
     add_filter( 'register_post_type_args', function( $args, $post_type ) {
         if ( 'attachment' === $post_type ) {
             $args['capabilities']['edit_posts']   = 'upload_files';
             $args['capabilities']['upload_files'] = 'upload_files';
         }
         return $args;
     }, 10, 2 );
 } );
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/19834#comment:42>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list