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?
- Changing the ‘wp-admin’ URL to whatever I want
- Unit testing in the WordPress backend (is_admin() is true)
- How can I improve the line break handling in the WYSIWYG editor?
- How do I change the login logo URL and hover title?
- Add mass action to wp-admin/users.php
- Can you change the main heading of a page in the WordPress admin (without output buffering or JavaScript)?
- How do you modify CSS files via admin panel?
- How to clone wp-admin and make a new dashboard controlled by your code?
- What is an “Options Framework” for WordPress
- show/hide toggle for subpages in wordpress admin area
- Additionally added URL params leading to “Invalid post type.” in the Admin Panel
- Detecting all admins that are logged in
- An update has caused my client’s site to be non-existent after new update of WordPress [closed]
- White screen of death for wp-admin and error for wp-login.php after entering credentials
- Is wp-admin/about.php required? Can i omit it from my website
- How to add Extra Column of post Status in All post page
- WP Admin Login keeps redirecting to login
- WordPress Redirects to a cancelled domain, need to change it but can’t get to the admin portal
- WordPress Admin Login Issue
- Wp-admin Redirection loop after moving to subdirectory
- Show only childs and grandchilds of certain post in admin
- WordPress logged in but no access to wp-admin
- Changed the path to wp-login and now can’t access WPress dashboard
- Why my login panel has a wrong language?
- Creating another wordpress site as sub-domain of a wordpress site
- Mixed content and expired session issues with SSL and wp-admin
- Limit access to wp-admin but still be able to log in from different locations?
- Working with post values in the admin panel
- wordpress login blank screen [closed]
- wp-admin blank page after admin login and all security off