WordPress.org

Make WordPress Core


Ignore:
Timestamp:
09/23/2016 08:32:48 PM (3 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/upload.php

    r37958 r38647  
    164164            $location = add_query_arg( 'deleted', count( $post_ids ), $location );
    165165            break;
     166        default:
     167            /**
     168             * Fires when a custom bulk action should be handled.
     169             *
     170             * The redirect link should be modified with success or failure feedback
     171             * from the action to be used to display feedback to the user.
     172             *
     173             * @since 4.7.0
     174             *
     175             * @param string $location The redirect URL.
     176             * @param string $doaction The action being taken.
     177             * @param array  $post_ids The posts to take the action on.
     178             */
     179            $location = apply_filters( 'handle_bulk_actions-' . get_current_screen()->id, $location, $doaction, $post_ids );
    166180    }
    167181
Note: See TracChangeset for help on using the changeset viewer.