WordPress

How to Remove or Modify Bulk Actions for Custom Post Types

It may be handy at times to be able to remove or modify the wording on the Bulk actions dropdown in WordPress. Learn how to do it!

Table of Contents

If you purchase through a link on our site, we may earn a commission.

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.

Jean Galea is an investor, entrepreneur, and writer. He is the founder of WP Mayor, and the plugins WP RSS Aggregator and Spotlight. He also runs the Good Life Collective. Connect with him on X or visit jeangalea.com.

If you purchase through a link on our site, we may earn a commission.

2 Responses

  1. ‘bulk_actions-edit-bank’ should be modified to ‘bulk_actions-edit-post’. or ‘bulk_actions-edit-page’
    See

Latest Articles from the Blog

Stay updated with WP Mayor's newsletter.

Discover the best and latest tools and services in WordPress every month.