0

When a user with Editor privileges logs in, they are bombarded with notices that they do not and should not care about.

How can I disable all nags for everyone except users with Administrator privileges?

1 Answer 1

1

You could remove all actions from the admin_notices hook. The best way to do that might be from the earliest priority of the hook itself, that way you catch any notices registered late.

add_action(
    'admin_notices',
    function() {
        if ( ! current_user_can( 'manage_options' ) ) {
            remove_all_actions( 'admin_notices' );
        }
    },
    0
);

The problem is that there's very little standardisation around admin notices, and there could be plugins that are registering notices in the incorrect way or in the incorrect places. So if any notices aren't caught by that code, you'd need to address them on a case by case basis.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.