diff --git a/wp-admin/includes/class-wp-comments-list-table.php b/wp-admin/includes/class-wp-comments-list-table.php index 122a719450..993fb7cafc 100644 --- a/wp-admin/includes/class-wp-comments-list-table.php +++ b/wp-admin/includes/class-wp-comments-list-table.php @@ -648,7 +648,7 @@ class WP_Comments_List_Table extends WP_List_Table { $edit_post_cap = $post ? 'edit_post' : 'edit_posts'; if ( ! current_user_can( $edit_post_cap, $comment->comment_post_ID ) - && ( ! empty( $post->post_password ) + && ( post_password_required( $comment->comment_post_ID ) || ! current_user_can( 'read_post', $comment->comment_post_ID ) ) ) { // The user has no access to the post and thus cannot see the comments. diff --git a/wp-admin/includes/class-wp-list-table.php b/wp-admin/includes/class-wp-list-table.php index 31168803d9..30d7c854cb 100644 --- a/wp-admin/includes/class-wp-list-table.php +++ b/wp-admin/includes/class-wp-list-table.php @@ -832,7 +832,7 @@ class WP_List_Table { $edit_post_cap = $post_object ? 'edit_post' : 'edit_posts'; if ( ! current_user_can( $edit_post_cap, $post_id ) - && ( ! empty( $post_object->post_password ) + && ( post_password_required( $post_id ) || ! current_user_can( 'read_post', $post_id ) ) ) { // The user has no access to the post and thus cannot see the comments. diff --git a/wp-admin/includes/dashboard.php b/wp-admin/includes/dashboard.php index bbbeb0b855..ea870a1f5b 100644 --- a/wp-admin/includes/dashboard.php +++ b/wp-admin/includes/dashboard.php @@ -1088,10 +1088,8 @@ function wp_dashboard_recent_comments( $total_items = 5 ) { } foreach ( $possible as $comment ) { - $comment_post = get_post( $comment->comment_post_ID ); - if ( ! current_user_can( 'edit_post', $comment->comment_post_ID ) - && ( ! empty( $comment_post->post_password ) + && ( post_password_required( $comment->comment_post_ID ) || ! current_user_can( 'read_post', $comment->comment_post_ID ) ) ) { // The user has no access to the post and thus cannot see the comments. diff --git a/wp-includes/version.php b/wp-includes/version.php index 6a7d8339d7..2163dbf807 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.5-alpha-57284'; +$wp_version = '6.5-alpha-57285'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.