WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I remove the "bulk actions" based on user roles or capabilities. Actually I have this code to do the job, but now I need to exclude the site admin, I need to let the administrator to access the bulk menu

add_filter( 'bulk_actions-' . 'edit-post', '__return_empty_array' );
add_filter( 'bulk_actions-' . 'upload', '__return_empty_array' );

How can I exclude roles or capabilities from that filter ?

share|improve this question
up vote 3 down vote accepted

I would do this this way - Just add a new mu plugin or normal plugin:

defined( 'ABSPATH' ) OR exit;
/** Plugin Name: Limit Bulk actions to Editor & Admin */

add_action( 'wp_loaded', 'wpse_53371_remove_bulk_actions' );
function wpse_53371_remove_bulk_actions()
    if ( ! is_admin() )

    if ( ! current_user_can( 'delete_others_pages' ) )
        add_filter( 'bulk_actions-edit-post', '__return_empty_array' );
        add_filter( 'bulk_actions-upload',    '__return_empty_array' );

this will check if current user is Editor or admin - if not then bulk actions will be removed. For more about Roles & Capabilities look here in the Codex.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.