Sounds like this is what you’re running into.
admin_page_access_denied may be the hook you want to use for this.
try
function dont_show_cheatin_page() {
if ( current_user_can( 'do_not_allow' ) ) {
wp_safe_redirect( admin_url()); // custom redirect instead of Cheatin 403 page
exit;
}
}
add_action('admin_page_access_denied', 'dont_show_cheatin_page');
Related Posts:
- How to remove “Super Admin” from All Users for those that are not a “Super Admin”?
- Can an admin check passwords of registered users?
- Disallowing Users of a Custom Role from Deleting or Adding Administrators?
- Make A WordPress Page Accessible To Admins Only, Redirect Other User Roles
- Customize Admin Users Screen based on Role
- Make certain pages uneditable by editors?
- How to display only logged in user’s post comments in comments area
- Restrict dashboard access for specific user roles to specific actions
- How can I restore admin capabilities?
- What determines whether admin toolbar is shown to a logged-in user?
- How do you set up a WordPress blog with multiple authors to allow something like StackExchange’s “community wiki” feature?
- Displaying different in-page content to cliente/admin
- Where are $current_user->allcaps set?
- WordPress Remove Submenus
- Shared account / dual blogging in WordPress
- Allow admins to login as other users
- Can I Create a Second Admin Level User Role?
- current_user_can(‘administrator’) not working in custom login
- Remove specific administrator’s capability
- Given multiple admin accounts, how can I make it so that only admin with X username can edit posts
- How should I setup the “Users” area to hand over to a client?
- Redirect non-admin after login, and in url – /admin
- Hide top admin panel for non admin and non editors
- How can I create multiple different admin roles with their own capabilities
- Different role for free and pro users in wordpress without using bbpress
- Capability to read/edit page in wp-admin only for administrators
- You do not have permission to access this document on form submit
- Getting a List of Currently Available Roles on a WordPress Site?
- Editor can create any new user except administrator
- Remove Ability for Other Users to View Administrator in User List?
- How do I remove dashboard access from specific user roles?
- Setting admin edit panels & metaboxes positions and visibility for ALL users and admins
- Groups of capabilities: users with multiple roles?
- User-edit role setting distinct from wp_capabilities? [closed]
- Allowing users to edit only their page and nobody else’s
- How to let contributors to create a new revision(draft) editing their published posts
- How to obtain the user ID of the current profile being edited in WP-Admin?
- Add Custom User Capabilities Before or After the Custom User Role has Been Added?
- How to assign specific users the capability to edit specific pages / posts / custom post types
- Hide Admin Menu for Specific User ID who has administrator Role
- How to get all capabilities of an existing user role
- Prevent author from changing their posts if admin has modified
- How to remove administrator role in settings -> general -> New User Default Role?
- Create un-removeable user
- Read only capability for custom post in admin area
- How to update user role without logout
- How to check user role without using current_user_can()
- The ‘user_has_cap’ hook seems to take two page loads to trigger
- Do not allow users to create new posts and pages
- Custom CSS In Admin Only For Certain Roles
- Remove ability to access certain admin menus
- Remove admin AND editor from the “change role to” menu in user listing
- \WP_User Object | What’s the Difference Between {caps} and {allcaps}?
- How to enable the theme editor cap for an editor role?
- Role that can edit only widgets, not other theme options
- How to assign capabilities to user NOT to User Role
- How to programmatically add a user to a role?
- Hide update messages from non-admin users?
- Prevent user creating new users with specific roles
- Add user capability and check against it
- how to add custom user capabilities using add_user_meta or something else?
- Customize the upload screen
- Add extra field when admin create user
- Add a custom column in users list page
- Blocking Administrative Access to Authors and Subcribers?
- How-to Delay The Capability To Publish Posts?
- How to restrict specific post types from being read or added by specific user roles (eg. author)?
- wp-admin: Sort users by surname
- Add User meta fields, which only admin can edit
- Add Admin User via SQL
- How to customize wp_signon()
- Is there a simple way to manage capabilities per user?
- Can you have the users list pre sorted by specific column?
- What is the difference between “create_users” and “add_users” capabilities?
- How to remove Gravatar from Username column
- Capability for allowing user to post own comments without moderation
- Can I create users that have access to *some* other users posts instead of all other users posts?
- Set default page for user account in admin
- User role permissions based on taxonomies
- Let new user role to ‘edit_others_posts’ of other user role, not of its own type
- How do I enable new account notification emails (to the administrator)?
- How can I have different groups of editors only allowed to edit certain parent+subpages?
- In administration, how do I display comments of a certain user?
- New users must comment when requesting username
- Add a wordpress blog to my website having users
- how to assign more permission to wordpress author
- user-new.php less detailed after WP3.1; how to revert?
- Custom post type capabilities require “create_posts” to access the edit posts list page
- Protect custom php file with login
- $user_id vs. is_user_logged_in()
- Get current logged in user under 3.1, re: remove “Howdy”
- Hide everything on site for visitors except specific page IDs
- Get User Role by ID not working
- Getting users by specific capability, not role
- Managing Users and Creating Groups [closed]
- Manage users custom column add class “num”
- front end editing using iFrames, best approach?
- How to disable a specific page for a specific user
- remove/hide pages from users backend
- How to restrict CPT post’s fronted view only for specific user roles?