To remove from the admin menu, you could use remove_menu_page():
add_action( 'admin_menu', function ( ) {
if (is_super_admin())
return;
remove_menu_page();
// or remove_submenu_page( ...
},99);
If for some reason the page still exists, it’s just missing it’s menu link, you could check the get_current_screen() to see if the page is being viewed, and prevent access:
add_action( 'admin_notices', function ( ) {
if (is_super_admin())
return;
$screen = get_current_screen();
if ($screen->parent_base == 'all-in-one-seo-pack') { // or wtv
wp_die('get out');
}
},99);
Related Posts:
- User restricted only show posts assigned to current user
- Hide front-end from every logged out user and redirect them to the default login page
- wp_update_user not updating
- Is WordPress’ is_user_logged_in() secure?
- Temporarily disable user role login and replace with message
- how to add custom user capabilities using add_user_meta or something else?
- Is there a way to set the user Role based on email domain
- pre_get_posts Remove posts based on meta value with ‘post__not_in’
- What is the difference between “create_users” and “add_users” capabilities?
- Access on specific pages in wordpress for a specific user
- How to ‘unpublish’ or ‘hide’ posts when user role changes?
- Hide Specific User Page
- Let new user role to ‘edit_others_posts’ of other user role, not of its own type
- How can I have different groups of editors only allowed to edit certain parent+subpages?
- Hide everything on site for visitors except specific page IDs
- How do I remove the Other Roles field (from User Role Editor plugin) in wp-admin/user-new.php
- How to redirect specific post type with user role
- wordpress editor role remove all but ‘menus’ in appearance menu
- Parent User and Child User – relate users
- How to create user specific pages (not user role!)?
- Assigning certain authors to specific editors
- Restrict Access in Admin Panel
- Limit a user to have access to only specified pages?
- Plugin creation – how to add user rights?
- Restrict custom post content to specific user
- Need to block user role from accessing bbPress all together
- How to create a front facing user sign up, log in and profile pages like FoodGawker.Com [closed]
- Infinite redirects at front end if logged in user is not an Admin (Toolset Access)
- Is there a way to allow users with “Subscriber” user role to access media library in backend and frontend
- How to make WP page accessile only to specific user roles
- grant multiple roles access to specific admin menu item
- How to show private pages based on a user’s role?
- Check what capabilitie(s) an action requires
- Is it possible to restrict a specific user to edit a specific custom post.
- Assign specific editor with custom user meta “A” to all authors with custom user meta “A” and exclude all other author access
- New folder and file permissions are not correct
- How to change user role setting in members plugin so that user can only edit his own post?
- How to get role of user
- How do I programmatically set default role for new users?
- Temporary capability for current_user_can()
- How to get all capabilities of an existing user role
- How to update role capabilities
- How to loop through each user id?
- Code needed to only show users own posts in a multi-user account
- Ordering users of a specific role by last name
- I need to assign a role to visitors/guests
- Auto Delete Users (auto_delete_users)
- New Roles and Capabilities in WordPress
- How to get all users with Author role capabilities?
- Add Role inherits?
- similar to Editor can create any new user except administrator
- How to check if a role has a specific capability
- Expire a user’s secondary role after X days from it being allocated
- Can a user with admin role get ‘Sorry, you are not allowed to move this item to the Trash’ error when trashing a post?
- Making shortcode of filtered number of comments by user role
- How to stop contributors editing post type but allowing them to edit a custom post type?
- how to assign more permission to wordpress author
- Allow Block Editing By User Role
- WordPress missing user roles on local dev machine. Live site works fine
- Programmatically allow a non-author to edit a post based custom meta field
- Customizer – Allow user editor to change website title and tagline
- Pending status by default for a specific role
- Getting a role based on a localized role name
- How do I restrict user access to plugins?
- Protect sequence of pages with same password for each of two groups of users
- Admin User Role Unable to See Private Posts
- Limit post display to post authors and create an exception for specific pages
- How to have kind of a technical writer role in wp website
- Undo User Role Name Change
- Where are $current_user->allcaps set?
- add_role user capability not working
- How can I promote a user to a network administrator?
- read_private_pages capability not working for new role
- How to change footer or for different kinds of users in wordpress?
- Grant a person permission to moderate all comments on a blog without giving them the ability to edit other peoples post
- Hiding custom theme functionality using capabilities
- How can I programattically hide all admin notices for everyone except admin users
- How to exclude subscriber from the list in wordpress
- What Capability is required to let a role RUN code in Edit Theme?
- Can I Create a Second Admin Level User Role?
- remove_cap nothing changes
- Retrieve user roles but exclude default roles
- Disabled delete_others_posts if post is from admin
- How to hide Add new Term area for taxonomy terms for specific role (Client)
- show the author’s role along with the name in the single.php
- How to create different views for different user roles?
- How to Enable registration email for a custom user role?
- Custom User Role: Can Edit Own Page, Cannot Create New
- How can I add the ability for a user to add/edit administrators?
- Allow signed in users (subscribers) to see their drafts
- How to sync user database with “user role editor” plugin enabled
- add user role selection to registration form [duplicate]
- Front end login and page restriction
- Grant access to admin menu?
- I want this code to work only for Authors AND Contributors
- Disable Woocommerce checkout based on user role [closed]
- Remove_role not working, gives “Call to undefined method stdClass::remove_role()”
- Adding a new role with administrator’s capabilities
- Get users by rôle in a list
- Role Scoper, don’t allow other users to see pending posts