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.
Related Posts:
- How to redirect specific post type with user role
- Block user roles from accessing the WordPress dashboard
- How to allow suscriber to access specific pages in dashboard?
- Removing Admin Bar Node Based on Role
- How to change a user’s role?
- Is there way to rename user role name without plugin?
- Possible to hide Custom Post Type UI/Menu from specific User Roles?
- How to add a Capability to a User Role?
- How can I get a list of users by their role?
- How to allow editor to edit privacy page / settings only?
- alphabetically order role drop-down selection in dashboard
- Is it possible to add new user Roles?
- Temporarily give ‘manage_options’ capability
- Hide specific admin users’ posts
- How to filter the role selector?
- How can I change a user role upon visiting a page?
- How to let the Contributor role preview unpublished posts?
- Assign Subscriber capabilities to a custom user role
- How to allow registered users to change their user role through frontend?
- how to change user roles for users who doesn’t have any. (about 8000 users)
- Shold I manually add ‘cap’ to admin role ?
- Getting a user role from the user login name
- WordPress Multisite Layered Admins
- Why is wp-login redirecting to the home page when I use this function?
- Allow contributor to view own scheduled post
- Editor and contributor roles not correct after adding function
- How to add author role as a custom field to custom post type in wordpress?
- How are roles stored in the database?
- How to delete user roles?
- I am adding a new class to my body tag if the logged in user is subscriber, need help
- Set default page for user account in admin
- How to Orderby User Role?
- Users Role and Access
- Prevent custom user role to add new pages
- Hide Specific User Page
- The delete_posts capability?
- Capabilites not working [closed]
- Why does this check to see if user is authorized to edit a post fail for all but super admins?
- get approved users only ( ultimate member plugin )
- Create Super Admin that cant be deleted
- Assign second role to user
- Adding Capabilities to a WordPress User Account
- Adding an additional role to an Administrator
- Allow editors to post iframes [duplicate]
- if user has a certain role then display image
- Parent User and Child User – relate users
- My subscriber has the “edit comment” capability but can’t edit comment
- New user is assigned 2 roles: customer and superadmin
- bbPress plugin moderator roles
- how to set any post creation for pending status and let the admin approve it first?
- Allowing user to edit posts based on the post status
- Allow user role “salesman” to view only “client” role users
- Purpose of Adding Capability to Role But Not Grant?
- bbPress: How to set conditional for specific user -or- user role, to be displayed in user profile
- Menu page with list of users
- How to check user role?
- how to remove some permissions from a shop “manager role” in woocommmerce?
- reset the users roles – is there a way to do this?
- Get and display a user’s profile info?
- How to get a users list by who created them?
- Paypal API and WordPress
- Is there a Capability that checks as true for non-logged in users?
- user_can() not working for comment authors
- WordPress add_rewrite_rule redirection match GET variable not passing through to custom template
- How to restrict an admin page, if the user is not superadmin?
- Let editors view post in admin but not be able to perform a save/edit
- Capabilities don’t add
- Migrating Roles from one environment to another
- Show menu in sidebar if on specific page AND specific user role (is_page, current_user_can)
- Letting users create a post that is a custom post type from a page
- Conditional Tag for Wishlist membership. If the user is added to two levels show particular content
- How to create a front facing user sign up, log in and profile pages like FoodGawker.Com [closed]
- Learndash change user role after completing the course
- How to disable activation email to specific user role?
- logout users with specific role after close browser tab
- Admin user name not showing up in author dropdown
- Adding all custom capabilities to admin
- current_user_can( ‘edit_user’ ) does not work
- Separate user bases or hide users of another role or connected to another minisite
- Need help with Task assigning and rewarding as currency which withdrawable
- How to restrict subscriber editing other posts but read specific posts in backend
- grant multiple roles access to specific admin menu item
- Change role in maintenance mode
- Publishing post strips custom html element when user is not admin
- Best practices to handle multilpe roles and capabilities?
- Check what capabilitie(s) an action requires
- Allow multiple roles to specific user
- user has permission to read a custom post but it is not being shown in wordpress plugin
- Restrict custom fields based on user roles
- Restrict content piece by role – Protection message in content?
- Select dropdown with 2 choices from foreach
- translate_user_role doesn’t work
- Is there a way for a limited user to just view the page of a post without being able to edit it?
- How do I make a draft post accessible to everyone?
- Authors Ability to Review Post from Contributors
- How to assign role to a custom registration form?
- How to add user roles? [closed]
- Check if specific role exists
- WordPress users roles wp-admin
- User roles empty