It may be handy at times to be able to remove or modify the wording on the Bulk actions dropdown in WordPress.
Here’s how to do it.
To remove actions, where bank is the name of the custom post type:
[php]
add_filter( ‘bulk_actions-edit-bank’, ‘my_custom_bulk_actions’ );
function my_custom_bulk_actions( $actions ){
unset( $actions[ ‘edit’ ] );
return $actions;
}
[/php]
We just removed the ‘Edit’ option from the dropdown.
You might think that that filter can also be used for other stuff like adding or modifying the items in the dropdown, however till now it can only be used to remove items.
That does not mean that it is altogether impossible to modify or add items. Check out this tutorial on Foxrunsoftware.netΒ which shows us an example of how we can add items to the bulk actions dropdown. I will report back once I find a solution to modifying the existing items. If you know how to do that, just leave a comment below!
If you are not sure what the screen ID of your page is, check out this excellent tutorial which will explain how to get the screen ID.
Finally, to remove the bulk actions dropdown altogether, you can use this codem where ‘edit-post’ is the screen ID:
[php]
add_filter( ‘bulk_actions-‘ . ‘edit-post’, ‘__return_empty_array’ );
[/php]
If you enjoyed this post, make sure to subscribe to WP Mayor’s RSS feed.
2 Responses
How to display message when i select delete action.
‘bulk_actions-edit-bank’ should be modified to ‘bulk_actions-edit-post’. or ‘bulk_actions-edit-page’
See