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?
- Administrator user cannot access dashboard after localwp import
- WordPress change role from administrator to author by itself (automatically)
- WP dashboard messed up
- Impossible to access the site administration
- Organizing Code in your WordPress Theme's functions.php File?
- How to check if a user is in a specific role?
- Can I rename the wp-admin folder?
- How do I Enqueue styles/scripts on Certain /wp-admin Pages?
- Adding custom columns to custom post types
- Adding Fields to the Category, Tag and Custom Taxonomy Edit Screen in the WordPress Admin?
- adding custom stylesheet to wp-admin
- Can’t change language (only “English (United States)”)
- Is there ANY way to remove comments function and section totally?
- How to use “menu_order” field for posts?
- “Too many redirects” ONLY when trying to access wp-admin page
- How to restrict dashboard access to Admins only?
- Admin Page Redirect
- Disable dragging of meta boxes?
- Toggle admin metabox based upon chosen page template
- Unable to login and wp-login.php redirects to wp-admin%2F&reauth=1?
- When moving a WP site, why does wp-admin redirect to old site?
- How to disable the “Post Lock/Edit Lock”?
- adding the category to the admin column for a custom post type?
- How can we make managing lots of pages in WordPress Admin better?
- Change page title in admin area
- do_shortcode() within Admin Page
- How can I control the position in the admin menu of items added by plugins?
- Changing the ‘wp-admin’ URL to whatever I want
- Unit testing in the WordPress backend (is_admin() is true)