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
- Remove Ability for Other Users to View Administrator in User List?
- Groups of capabilities: users with multiple roles?
- 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 assign specific users the capability to edit specific pages / posts / custom post types
- 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
- The ‘user_has_cap’ hook seems to take two page loads to trigger
- \WP_User Object | What’s the Difference Between {caps} and {allcaps}?
- How to enable the theme editor cap for an editor role?
- Prevent user creating new users with specific roles
- Customize the upload screen
- How-to Delay The Capability To Publish Posts?
- wp-admin: Sort users by surname
- Add User meta fields, which only admin can edit
- Add Admin User via SQL
- 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)?
- 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
- Custom post type capabilities require “create_posts” to access the edit posts list page
- Protect custom php file with login
- Hide everything on site for visitors except specific page IDs
- Get User Role by ID not working
- How to disable a specific page for a specific user
- remove/hide pages from users backend
- Roles for Custom Post Types
- Admin cannot publish
- Subsite access without being a member of the subsite in wp multisite network
- How to hide a specific part of dashboard for non-admin roles?
- Add a role and give admin priviledges
- Create custom post with custom user rules
- How can I make the user names of commentors clickable links to the user’s profile from the admin comment screen?
- Keep Logged in Users out of Admin Panel
- Create a User Role with permissions to only upload files to the media library?
- How to get a users list by who created them?
- Create a WordPress administrator without access to back-end
- Only Admin can Edit, Delete or Update
- add_cap for editor but no admin role
- How can I prevent certain custom roles from seeing other custom roles on the user list page?
- Bind custom role to admin page
- solution to prevent specific admins from altering site contents
- Admin user roles/permissions
- Want to know who is login Admin/User
- How should I change the username of or delete the admin user?
- Prevent Registration Where Role is None?
- Extending the user profile [closed]
- Allow a user or role to view drafts and previews, but not other admin privileges?
- How to make WordPress ‘editor’ role to list/view/add/edit users only with the role ‘author’?
- How To Remove Import/Export Option From Tools?
- Cannot access wp-admin after installing SSL – user capabilities not being set
- Check what capabilitie(s) an action requires
- Disabling user capability to edit_posts or delete_posts in the front-end
- When admin approves a registered user, I don’t want to send a notification email to users
- WordPress install checking permissions of user id 0
- Allowing users to edit only their page and nobody else’s
- How to bulk change user role to “No role for this site”
- Signed-in as admin on just part of the site
- each user having category with their name and can add sub categories post in that category
- Control Category of each user can post
- Want to add post to user dashboard
- I don’t have permission to save the theme options I created myself?
- Different customer login form than administrator login form?
- Is it possible to tell if a user is logged into WordPress from looking at the cookies which are set?
- Add a user to edit the layout of a site