The bulk_post_updated_messages WordPress PHP filter allows you to modify the bulk action update messages for custom post types.
Usage
add_filter('bulk_post_updated_messages', 'my_custom_bulk_messages', 10, 2); function my_custom_bulk_messages($bulk_messages, $bulk_counts) { // your custom code here return $bulk_messages; }
Parameters
$bulk_messages
(array[]): Arrays of messages, each keyed by the corresponding post type. Messages are keyed with ‘updated’, ‘locked’, ‘deleted’, ‘trashed’, and ‘untrashed’.$bulk_counts
(int[]): Array of item counts for each message, used to build internationalized strings.
More information
See WordPress Developer Resources: bulk_post_updated_messages
Examples
Customizing messages for a ‘book’ post type
This example modifies the messages for the ‘book’ post type when bulk actions are performed.
add_filter('bulk_post_updated_messages', 'my_custom_book_bulk_messages', 10, 2); function my_custom_book_bulk_messages($bulk_messages, $bulk_counts) { $bulk_messages['book'] = array( 'updated' => _n('%s book updated.', '%s books updated.', $bulk_counts['updated']), 'locked' => _n('%s book not updated, somebody is editing it.', '%s books not updated, somebody is editing them.', $bulk_counts['locked']), 'deleted' => _n('%s book permanently deleted.', '%s books permanently deleted.', $bulk_counts['deleted']), 'trashed' => _n('%s book moved to the Trash.', '%s books moved to the Trash.', $bulk_counts['trashed']), 'untrashed' => _n('%s book restored from the Trash.', '%s books restored from the Trash.', $bulk_counts['untrashed']), ); return $bulk_messages; }
Customizing messages for a ‘movie’ post type
This example modifies the messages for the ‘movie’ post type when bulk actions are performed.
add_filter('bulk_post_updated_messages', 'my_custom_movie_bulk_messages', 10, 2); function my_custom_movie_bulk_messages($bulk_messages, $bulk_counts) { $bulk_messages['movie'] = array( 'updated' => _n('%s movie updated.', '%s movies updated.', $bulk_counts['updated']), 'locked' => _n('%s movie not updated, somebody is editing it.', '%s movies not updated, somebody is editing them.', $bulk_counts['locked']), 'deleted' => _n('%s movie permanently deleted.', '%s movies permanently deleted.', $bulk_counts['deleted']), 'trashed' => _n('%s movie moved to the Trash.', '%s movies moved to the Trash.', $bulk_counts['trashed']), 'untrashed' => _n('%s movie restored from the Trash.', '%s movies restored from the Trash.', $bulk_counts['untrashed']), ); return $bulk_messages; }
Customizing messages for a ‘recipe’ post type
This example modifies the messages for the ‘recipe’ post type when bulk actions are performed.
add_filter('bulk_post_updated_messages', 'my_custom_recipe_bulk_messages', 10, 2); function my_custom_recipe_bulk_messages($bulk_messages, $bulk_counts) { $bulk_messages['recipe'] = array( 'updated' => _n('%s recipe updated.', '%s recipes updated.', $bulk_counts['updated']), 'locked' => _n('%s recipe not updated, somebody is editing it.', '%s recipes not updated, somebody is editing them.', $bulk_counts['locked']), 'deleted' => _n('%s recipe permanently deleted.', '%s recipes permanently deleted.', $bulk_counts['deleted']), 'trashed' => _n('%s recipe moved to the Trash.', '%s recipes moved to the Trash.', $bulk_counts['trashed']), 'untrashed' => _n('%s recipe restored from the Trash.', '%s recipes restored from the Trash.', $bulk_counts['untrashed']), ); return $bulk_messages; }
Customizing messages for an ‘event’ post type
This example modifies the messages for the ‘event’ post type when bulk actions are performed.
add_filter('bulk_post_updated_messages', 'my_custom_event_bulk_messages', 10, 2); function my_custom_event_bulk_messages($bulk_messages, $bulk_counts) { $bulk_messages['event'] = array( 'updated' => _n('%s event updated.', '%s events updated.', $bulk_counts['updated']), 'locked' => _n('%s event not updated, somebody is editing it.', '%s events not updated, somebody is editing them.', $bulk_counts['locked']), 'deleted' => _n('%s event permanently deleted.', '%s events permanently deleted.', $bulk_counts['deleted']), 'trashed' => _n('%s event moved to the Trash.', '%s events moved to the Trash.', $bulk_counts['trashed']), 'untrashed' => _n('%s event restored from the Trash.', '%s events restored from the Trash.', $bulk_counts['untrashed']), ); return $bulk_messages; }
Customizing messages for a ‘product’ post type
This example modifies the messages for the ‘product’ post type when bulk actions are performed.
add_filter('bulk_post_updated_messages', 'my_custom_product_bulk_messages', 10, 2); function my_custom_product_bulk_messages($bulk_messages, $bulk_counts) { $bulk_messages['product'] = array( 'updated' => _n('%s product updated.', '%s products updated.', $bulk_counts['updated']), 'locked' => _n('%s product not updated, somebody is editing it.', '%s products not updated, somebody is editing them.', $bulk_counts['locked']), 'deleted' => _n('%s product permanently deleted.', '%s products permanently deleted.', $bulk_counts['deleted']), 'trashed' => _n('%s product moved to the Trash.', '%s products moved to the Trash.', $bulk_counts['trashed']), 'untrashed' => _n('%s product restored from the Trash.', '%s products restored from the Trash.', $bulk_counts['untrashed']), ); return $bulk_messages; }