Comments: Remove bulk action dropdown depending on user caps.

This changeset adds a conditional to show the comments bulk actions dropdown only when the current user has `moderate_comments` capability.

Props snicco, iflairwebtechnologies, shanemuir, audrasjb.
Fixes #59440.



git-svn-id: https://develop.svn.wordpress.org/trunk@59877 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jb Audras 2025-02-26 23:48:24 +00:00
parent b607715ba7
commit bbdd9fb4a9

View File

@ -357,6 +357,10 @@ class WP_Comments_List_Table extends WP_List_Table {
protected function get_bulk_actions() {
global $comment_status;
if ( ! current_user_can( 'moderate_comments' ) ) {
return array(); // Return an empty array if the user doesn't have permission
}
$actions = array();
if ( in_array( $comment_status, array( 'all', 'approved' ), true ) ) {