From b364ff86e5b750daae1e8768e80e96079f06e8b4 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Fri, 8 Jan 2021 17:18:07 +0000 Subject: [PATCH] Posts, Post Types: Introduce the `wp_list_table_show_post_checkbox` filter which allows the visibility of the bulk edit checkbox on the post list table to be controlled separately from the `edit_post` capability of the current user. Props coreyw, alexstine Fixes #51291 Built from https://develop.svn.wordpress.org/trunk@49950 git-svn-id: http://core.svn.wordpress.org/trunk@49649 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/class-wp-posts-list-table.php | 14 +++++++++++++- wp-includes/version.php | 2 +- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/wp-admin/includes/class-wp-posts-list-table.php b/wp-admin/includes/class-wp-posts-list-table.php index 22a46d27c9..a82bad702d 100644 --- a/wp-admin/includes/class-wp-posts-list-table.php +++ b/wp-admin/includes/class-wp-posts-list-table.php @@ -925,7 +925,19 @@ class WP_Posts_List_Table extends WP_List_Table { * @param WP_Post $post The current WP_Post object. */ public function column_cb( $post ) { - if ( current_user_can( 'edit_post', $post->ID ) ) : + $show = current_user_can( 'edit_post', $post->ID ); + + /** + * Filters whether to show the bulk edit checkbox for a post in its list table. + * + * By default the checkbox is only shown if the current user can edit the post. + * + * @since 5.7.0 + * + * @param bool $show Whether to show the checkbox. + * @param WP_Post $post The current WP_Post object. + */ + if ( apply_filters( 'wp_list_table_show_post_checkbox', $show, $post ) ) : ?>