mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
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.
git-svn-id: https://develop.svn.wordpress.org/trunk@38647 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -436,7 +436,7 @@ class WP_List_Table {
|
||||
*/
|
||||
protected function bulk_actions( $which = '' ) {
|
||||
if ( is_null( $this->_actions ) ) {
|
||||
$no_new_actions = $this->_actions = $this->get_bulk_actions();
|
||||
$this->_actions = $this->get_bulk_actions();
|
||||
/**
|
||||
* Filters the list table Bulk Actions drop-down.
|
||||
*
|
||||
@@ -450,7 +450,6 @@ class WP_List_Table {
|
||||
* @param array $actions An array of the available bulk actions.
|
||||
*/
|
||||
$this->_actions = apply_filters( "bulk_actions-{$this->screen->id}", $this->_actions );
|
||||
$this->_actions = array_intersect_assoc( $this->_actions, $no_new_actions );
|
||||
$two = '';
|
||||
} else {
|
||||
$two = '2';
|
||||
|
||||
Reference in New Issue
Block a user