Make WordPress Core

Changeset 59877


Ignore:
Timestamp:
02/26/2025 11:48:24 PM (2 months ago)
Author:
audrasjb
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-comments-list-table.php

    r58888 r59877  
    357357    protected function get_bulk_actions() {
    358358        global $comment_status;
     359
     360        if ( ! current_user_can( 'moderate_comments' ) ) {
     361            return array(); // Return an empty array if the user doesn't have permission
     362        }
    359363
    360364        $actions = array();
Note: See TracChangeset for help on using the changeset viewer.