apply_filters( “bulk_actions-{$this->screen->id}”, array $actions )

Filters the items in the bulk actions menu of the list table.

Description

The dynamic portion of the hook name, $this->screen->id, refers to the ID of the current screen.

Parameters

$actionsarray
An array of the available bulk actions.

More Information

  • This hook allows you to remove items from the bulk actions dropdown on any specified admin screen.
  • Bulk actions are a simple associative array.
  • The filter hook follows the format ‘bulk_actions-screenid‘, where screenid is the id of the admin screen that you want to affect.
  • As of version 4.7, custom bulk actions can be added using this filter. You can add functionality to custom bulk actions using ‘handle_bulk_actions-screenid‘, where screenid is the id of the admin screen that you want to affect.

Source

$this->_actions = apply_filters( "bulk_actions-{$this->screen->id}", $this->_actions ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores

Changelog

VersionDescription
5.6.0A bulk action can now contain an array of options in order to create an optgroup.
3.1.0Introduced.

User Contributed Notes

  1. Skip to note 2 content

    Example migrated from Codex:

    The following example removes an action from the Bulk Actions drop-down on the Users page:

    <?php
        function my_custom_bulk_actions($actions) {
            unset( $actions['delete'] );
            return $actions;
        }
        add_filter('bulk_actions-users','my_custom_bulk_actions');
    ?>

    Pay attention to the actual option values, not just the text displayed in the dropdown, on the page you wish to modify. For example, the delete option on the Plugins list page is “delete-selected” (as of 4.2.2).

You must log in before being able to contribute a note or feedback.