[Pro Sites] Is it possible to remove all admin notices except for those that are from Pro Sites?

I have a few plugins installed that show annoying admin notices, and I have removed them with:

function hide_update_noticee_to_all_but_admin_users()
{
if (!is_super_admin()) {
remove_all_actions( 'admin_notices' );
}
}
add_action( 'admin_head', 'hide_update_noticee_to_all_but_admin_users', 1 );

The problem is this also removes important notices, especially those from Pro Sites related to account expirations. Is there a way to restrict notices by theme / plugin instead of by user role? Or a way to make sure Pro Sites and other important WMPU Dev account notices get through?

  • Nastia

    Hello blue

    Hope you're doing well!

    The above code hides all the notices, please instead of this code try the following plugin:
    https://wordpress.org/plugins/disable-admin-notices/

    The plugin can hide notifications forever.

    Another solution is to hide notices with CSS code. Please create a hide_update_msg_non_admins.php file and add the code below. Upload the file to mu-plugins folder

    <?php
    function hide_update_msg_non_admins(){
         if (!current_user_can( 'manage_options' )) { // non-admin users
                echo '<style>#admin-notice { display: none; }</style>';
            }
        }
        add_action( 'admin_head', 'hide_update_msg_non_admins');

    Instead of #admin-notice { display: none; } add the CSS code that will hode certains messages.

    Let us know if you have any further questions!

    Kind regards,
    Nastia

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.