Checking the bulk counts
We can check the bulk counts, to see if any post was deleted:
add_filter( 'bulk_post_updated_messages', function( $bulk_messages, $bulk_counts )
{
// Check the bulk counts for 'deleted' and add notice if it's gt 0
if( isset( $bulk_counts['deleted'] ) && $bulk_counts['deleted'] > 0 )
add_filter( 'admin_notices', 'wpse_243594_notice' );
return $bulk_messages;
}, 10, 2 );
where we define the callback with our custom notice as:
function wpse_243594_notice()
{
printf(
'<div class="notice notice-info is-dismissible">%s</div>',
esc_html__( 'Hello World!', 'domain' )
);
}
The bulk counts contains further info for updated, locked, trashed and untrashed.
Output example
Hope you can adjust this further to your needs!
Related Posts:
- wp_logout_url() – WordPress Failure Notice
- Warning Notice $wpdb->prepare incorrect number of arguments passed
- Notices on the front-end
- Alter admin notices to remove message that contain a certain string
- PHP Notice: Undefined offset: 0
- Plugin activation/deactivation page transitions with page parameters, then vanished
- Annoying “JQMIGRATE: Migrate is…” in console after update to WordPress 4.5
- WP_DEBUG is not set, but I’m still getting warnings
- How to pass parameters to admin_notices?
- Is there anything like admin_notices for front end?
- How to stop showing admin notice after close button has been clicked
- get_the_ID() gives notice in 404 page
- Hide php Notices in Dashboard
- How to Make an admin_notices Message That Disappears Once the User Leaves That Particular Page?
- How to customize post edit notices
- WordPress admin notice in plugin function
- register_sidebar notice [closed]
- Undefined property: stdClass::$labels in general-template.php post_type_archive_title()
- admin_notices after register_uninstall / deactivate_hook
- Is it possible to set a option, and then redirect to another page directly from a admin notice link?
- How do I fire a snackbar notice in admin?
- How to add a link to the tax term in the admin Edit page?
- Admin Notices coding standard issue
- Change message given when deleting post from custom post type
- Remove Admin Notice on page refresh
- How to notify the admin about something that happened during a cron job
- How to change the location of admin notice in html without using Javascript?
- admin_notices not displaying in plugin
- my theme breaks WP export
- Notice: wp_enqueue_script was called incorrectly
- PHP notice coming from the WordPress core?
- Is there a way to hook into the update-core page for custom messages?
- What is the callback sent to add_submenu_page() invoked by WordPress?
- Notices in the Block Editor with multiple lines
- Wordpres debug.log PHP Notice: is_singular was called
- Admin Notices don’t display on the admin screen for certain post
- wp-includes/comment-template.php:26 – Trying to get property of non-object
- How do I add an admin notice within javascript in the admin interface for posts?
- Cannot DIsplay a Snackbar Notice on Button Click – Notice is undefined
- WordPress notification reports
- Mute Debug Messages from Plugins
- Notice: Trying to get property ‘term_id’ of non-object
- How to display a WordPress notice on create_term action
- How to do persistent data on Front End?
- How to inform the user that the save was not successful?
- Display popup or admin-notice after add new categories
- Popup or admin/update notice on post/page edit screen without page refresh
- Deprecated issue in WordPress [closed]
- How to throw admin notice error on image upload
- How to disable admin notice in child theme? [closed]
- How does one dismiss the ‘upgrade notice’ when managing upgrades with SVN?
- CPT Validation to not show “Post updated.”
- Show error message after exception handled
- WordPress custom admin notice still displays after wp_insert_post_data validation
- Getting notices on fresh 3.6.1 install
- Show message in media-new.php
- Debug Notice: X is deprecated since version 4.5! Use Y instead
- Plugin Options Array Set to Undefined
- relocate woocommerce notices/messages on Cart page
- Getting admin notices to appear after page refresh
- Show message from backend
- Displaying “One Time” Notification in Plugins
- How to remove ‘wordpress…’ text from page titles in tabs
- How to create Admin Notice from Plugin with argument? [duplicate]
- register_setting & add_settings_error validation issues with multiple fields
- Can not add admin notices from the edit_user_profile_update hook (notices not being displayed)?
- Hide admin notice when user profile updated
- admin notice on Insert Media popup screen
- Problem with display data from get_option
- Dynamically set taxonomy term and show admin notice on post save
- wp_new_comment requires author url and author email
- wp_get_http has been deprecated. Use WP_Http instead
- How to create an Underconstruction message and Setting for a WordPress website without using plugin
- Trying to get property of non-object wordpress error message
- WordPress multiple admin notices on post update/add
- How $_GET[‘updated’] variable is passed when updating a user?
- Changing the HTML of notices in WooCommerce [closed]
- Hide all Admin Notices and move on a separate page
- Changing wordpress/woocommerce notices default message to other languages (text)
- How to display only specific Error types in debug.log? No notices, warnings, etc
- Notices are render inside sub-menu’s content
- Troubleshooting Admin_Notice
- admin_notices is not working inside function
- Is it possible to push admin notices to one specific user instead of all users?
- Get property of non-object on theme activation
- Find out if post was just updated on post edit screen
- Trying to get property of non-object notices in comment-template.php
- A more elegant way to handle notices/warnings
- Unable to render Admin Notices
- Hook into admin_notices after sending mail
- Notice: Undefined index: in options-framework.php
- Notice: Trying to get property of non-object in options.php
- Notices when submitting custom post type from front-end
- Notice- undefined variable post and trying to get property of non-object
- Display notice in block editor after wp_insert_post_data hook