[wp-trac] [WordPress Trac] #51291: Add filter to show post list table `column_cb` even without `edit_post` capability

WordPress Trac noreply at wordpress.org
Fri Jan 8 16:00:35 UTC 2021


#51291: Add filter to show post list table `column_cb` even without `edit_post`
capability
-------------------------------------------------+-------------------------
 Reporter:  coreyw                               |       Owner:
                                                 |  johnbillion
     Type:  enhancement                          |      Status:  accepted
 Priority:  normal                               |   Milestone:  5.7
Component:  Posts, Post Types                    |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  good-first-bug needs-testing has-    |     Focuses:
  patch                                          |  administration
-------------------------------------------------+-------------------------

Comment (by johnbillion):

 I just had a thought. If the result of the `current_user_can` check is
 used as the default value of the filter (instead of being used in place)
 then the filter can be used both to forcibly enable the checkbox when
 needed and to forcibly disable it when it isn't needed.

 Example:

 {{{
 $show = current_user_can( 'edit_post', $post->ID );

 /** ... */
 if ( apply_filters( 'wp_list_table_show_post_checkbox', $show, $post ) ) :
 }}}

 @alexstine What do you think?

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


More information about the wp-trac mailing list