[wp-trac] [WordPress Trac] #16031: Bulk actions: Reactivate bulk actions hook + add hander hook for all admin screens

WordPress Trac noreply at wordpress.org
Tue Sep 20 22:20:13 UTC 2016


#16031: Bulk actions: Reactivate bulk actions hook + add hander hook for all admin
screens
----------------------------+-----------------------
 Reporter:  Veraxus         |       Owner:
     Type:  enhancement     |      Status:  assigned
 Priority:  normal          |   Milestone:  4.7
Component:  Administration  |     Version:  3.1
 Severity:  normal          |  Resolution:
 Keywords:  has-patch       |     Focuses:
----------------------------+-----------------------

Comment (by ericlewis):

 Thanks for the updated patch @Veraxus! In attachment 16031.4.diff

 * Instead of rewriting some of the surrounding action handling `switch()
 {}` statements, I've written some specifically targeted if statements to
 trigger the custom action. This avoids larger refactors of this code.
 * Add `check_admin_referer()` calls for XSRF protection.
 * Add type coercion and checking borrowed from neighboring bulk handlers.

 @DrewAPicture can you take a look at the docs here if you have a chance?
 Thanks!

 I've updated the test plugin in attachment:bulk-action-test-plugin.php —
 two squirelly bits:

 * You need to manually remove the query string from the action-completed
 handler, like in
 [https://github.com/WordPress/WordPress/blob/866bd39813521331d688d843f79bc5cfd545be5f
 /wp-admin/edit.php#L332 edit.php]. Otherwise a success or failure message
 displayed will persist over refreshes or completing other bulk edit
 actions.
 * Should also add the query string key to the `removable_query_args`
 filter.

 Could use some testing, code review and any other feedback.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/16031#comment:88>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list