Hide post "Post. View post" admin note in WordPress

Does anyone know how to hide the Posted message that appears after posting a post to a WordPress site in the admin.

I've seen this example to hide the Update Available message to everyone except the admin, but I'm 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 delete a post on both regular posts and custom post types. As far as I can tell, this should only be a replacement case 'update_nag'

, but I'm not sure what to replace it with.

thank

+3


source to share


1 answer


This should remove the "Posted Post" message.

add_filter( 'post_updated_messages', 'post_published' );

function post_published( $messages )
{
    unset($messages[post][6]);
    return $messages;
}

      



The above option is based on this answer modified to remove the "Published Message" message.

+4


source







All Articles