Does anyone know how to hide the Post Published message that appears once a post has been published on a WordPress site in the admin.
I have seen this example to hide the Update Available message to all but the admin, but I am not sure what needs to be added to remove the save message:
function hide_update_notice_to_all_but_admin_users()
{
if (!current_user_can('update_core')) {
remove_action( 'admin_notices', 'update_nag', 3 );
}
}
add_action( 'admin_head', 'hide_update_notice_to_all_but_admin_users', 1 );
I need to remove the message on both regular posts and on custom post types. As far as I can tell, it should be just a case of replacing 'update_nag'
but I am unsure of what to replace it with.
Thanks
This should remove the "Post Published" message.
add_filter( 'post_updated_messages', 'post_published' );
function post_published( $messages )
{
unset($messages[post][6]);
return $messages;
}
The above is based on this answer, modified to only remove the "Post Published" message.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With