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 blogger. He is the founder of WP Mayor, the plugins WP RSS Aggregator and Spotlight, as well as the Mastermind.fm podcast. His personal blog can be found at jeangalea.com.

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

More from our blog...

2 Responses

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

Post a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Stay updated with WP Mayor's newsletter showcase every week

Stay on top of every new WordPress innovation and latest launches. Receive all our fresh product reviews and expert guides directly in your inbox.

Hosting Survey 2024

Are you happy with your hosting provider or are you over-paying for too little? Have your say below!

"*" indicates required fields

What's the main reason you picked this host?*
How happy are you with your host?*

OPTIONAL: If you'd like to receive the results of this survey, please enter your details below.