Make WordPress Core


Ignore:
Timestamp:
09/23/2016 08:32:48 PM (8 years ago)
Author:
ericlewis
Message:

Allow custom bulk actions in admin list tables.

Bulk action filtering was introduced in 3.1, but only to remove default bulk actions, not add new ones.

Bulk actions can now be registered for all admin list table dropdowns via the bulk_actions-{get_current_screen()->id} filter. Handling custom bulk actions can be performed in the corresponding and newly introduced handle_bulk_actions-${get_current_screen()->id} filter.

Props scribu, flixos90, Veraxus.
See #16031.

File:
1 edited

Legend:

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

    r38334 r38647  
    437437    protected function bulk_actions( $which = '' ) {
    438438        if ( is_null( $this->_actions ) ) {
    439             $no_new_actions = $this->_actions = $this->get_bulk_actions();
     439            $this->_actions = $this->get_bulk_actions();
    440440            /**
    441441             * Filters the list table Bulk Actions drop-down.
     
    451451             */
    452452            $this->_actions = apply_filters( "bulk_actions-{$this->screen->id}", $this->_actions );
    453             $this->_actions = array_intersect_assoc( $this->_actions, $no_new_actions );
    454453            $two = '';
    455454        } else {
Note: See TracChangeset for help on using the changeset viewer.