Add mass action to wp-admin/users.php

Unfortunately this isn’t possible. Custom actions cannot be added to the bulk actions dropdown (see trac tickets: http://core.trac.wordpress.org/ticket/12732 and http://core.trac.wordpress.org/ticket/16031).

For posts you can use the restrict_manage_posts hook to create another drop-down / add buttons to trigger your custom action. But there is no restrict_manage_* hook available for the user table.

So the only (and not particularly pretty) workaround is to use javascript to insert extra options into the drop-down menu.

However, there is no (supported) way of handling the action – so this would also have to be handled yourself by hooking into the load-* or admin_action_* hook. (See the core files here).

You would then need to check the posted data (the user IDs, the action identifier, nonce, etc) inside that hook and then you would need to check the nonce and the current user’s capability to perform that action.

See related question: Custom bulk_action

Leave a Comment