Use this code in your functions.php file or in a plugin-
function wpse_253580_prevent_author_access(){
if( current_user_can( 'author' ) && is_admin() ) {
// do something here. maybe redirect to homepage
wp_safe_redirect( get_bloginfo( 'url' ) );
}
}
add_action( 'admin_init', 'wpse_253580_prevent_author_access' );
This will check if current user is an author and he is trying to access wp-admin area. If true, then redirect him to homepage.
Related Posts:
- Localhost install: Administrator lost administrator access; cannot access Dashboard
- Changing Admin Menu Labels
- Remove dashboard, use Pages tab as default
- Add “external” link to admin menu in the backend
- How to display the user that published a pending post?
- How to remove the site health dashboard widget?
- Only allow administrators and editors to access wp-admin
- Copy my user account’s wp-admin dashboard layout to other users?
- Make sub menu items a main link in the admin menu using fuctions.php
- How to disable or hide “collapse menu”
- Dashboard links not working
- Moving wordpress from localhost to server throws admin panel access error?
- Removing admin bar from wordpress dashboard
- Can’t access dashboard, connection times out (other pages work fine)
- wp-admin does not redirect to dashboard
- Cannot log into WordPress Dashboard after removing/adding .htaccess
- Custom WordPress Dashboard for Specific user role
- How to inhibit dashboard and profile management access to normal users?
- Only allow administrators and editors to access wp-admin
- Show Welcome Panel on Dashboard for every user
- Prevent /wp-admin/ from redirecting to homepage?
- How do I set the homepage to the WordPress Admin Dashboard login?
- Create a fullwidth dashboard widget
- Can’t access WordPress as an admin – but I can log in as a user!
- Locked Out Of WordPress Admin Dashboard After Server Move
- Redirect non-admin users away from wp-admin/index.php (main dashboard page) to wp-admin/profile.php
- admin_post action not usable if admin access denied to user
- Restrict Author role to only 3 wp-admin pages
- Wp-admin is giving me an error “Sorry, you are not allowed to access this page.”. I do have access to the wp-admin besides the dashboard itself
- WP-Admin shows (1) update but there is no update for plugin, theme or WordPress
- White screen of death in Dashboard after clean installation
- How do I let logged out users see the dashboard?
- How can I replace dashboard.css and dashboard.min.css (not add new css)
- WP admin user search doesn’t return all users
- I can´t access my admin panel. I tried all possible solutions
- can not access wp-admin after migrating to openshift
- Lost administrator privileges and can’t find a fix
- How do you force the wordpress dashboard to be 1 coulmn by default?
- always by default show welcome panel in the dashboard
- Deploying WordPress for clients – what do they have access to?
- Dashboard Widget CSS
- How can I limit page parent dropdown to show only author’s own pages?
- Admin top level menu, pointing to an external url
- How to Find The Email of a WP Admin Account
- how can I change the font on Edit Post area (admin dashboard)
- Dashboard : remove Safari navigator message
- Move WooCommerce menu entries to top of dashboard
- Is WordPress secure enough for a multi-user article directory?
- Change maxlength of link_description in dashbord link section?
- define two login page url
- Trying to create a page as a menu item in the admin while keeping the admen panel visible
- Broken Customizer page
- Admin Page access
- I can’t access my wp admin dashboard
- Not able to access WP Admin, it says “Sorry, you are not allowed to access this page.”
- How to logout the current user without notices and warnings?
- Step by step guide for new users on how to post content?
- How to log into WordPress via GET/POST
- restrict admin panel sections to users
- Getting 404s in wp-admin after logged in
- Admin section showing CUSTOM Permalink structure thus resulting in permission error [closed]
- Unable to access dashboard (wp-admin) only
- Launch wordpress site to local computer from live website backed-up
- Removing Author name
- All of my WordPress sites have Bold Open Sans
- WordPress blog fails to open
- Is it possible to tell if a user is logged into WordPress from looking at the cookies which are set?
- How to make the Panel // WP-Admin lighter via Mobile
- How can you change the admin dashboard URL without symlinking?
- After Upgrade: $user becomes unknown (id: 0) after successful login?
- Admin utility classes?
- WP dashboard messed up
- Creating an custom admin page from scratch
- Have different site location for wp-admin in IIS
- How to display site title with post title?
- 100+ terms in any taxonomy slows down post updates?
- Is WordPress Suitable for my site?
- Disable or lock parent pages from being edited in wordpress admin
- How login is possible, if I deny login page via .htaccess with allow ip
- Unable to display WordPress admin bar in the frontend as an admin
- unsuccessful attempt to change domains- wordpress re-routing to old domain
- Icons are missing from Visual Editor
- how can provide access to wp_admin page for non wp_users?
- jQuery UI Datepicker error
- Can’t connect to WP-Admin, blank error message
- Can’t access wp-admin after http to https change
- WordPress /wp-admin redirect to wrong port in docker
- How do I fix the 403 error for wp-admin/admin-ajax.php?
- Strange Popup Ad on my WordPress Admin Dashboard
- Trying to list user and post information from (wp_includes/post.php ) causes Fatal error
- Unable to Add User after Site Migration
- WordPress User profile page fields missing
- Trying to use and understand JSON API and get_posts
- Customize a WP_Posts_List_Table class
- Help please i cant login to wordpress panel [closed]
- Extend user search in the Wp backend area on the users.php page to allow for searching by email domain and role from the “users search” input box
- wp-admin is opening but the site isn’t opening
- Can’t Access Wp-admin Login Page I get 500 error
- Unable to login or reset password via wp-admin
- How to prevent a user from updating other users in WordPress?