Yeeey, I figured it out! Actually my theme had a redirect like this one in functions.php
:
// Block Access to /wp-admin for non admins.
function custom_blockusers_init() {
if ( is_user_logged_in() && is_admin() && !current_user_can( 'administrator' ) ) {
wp_redirect( home_url() );
exit;
}
}
add_action( 'init', 'custom_blockusers_init' ); // Hook into 'init'
All you have to do is add your own role capability, for example: !current_user_can( 'manage-reports' )
This helped me a lot.
Related Posts:
- Can’t access admin dashboard with wp-admin without /index.php after it
- wp-admin – 404 after custom login form
- How to fix ‘WordPress redirection loop problem in wp-login.php page’?
- WP Admin Login keeps redirecting to login
- CPU overload spam – redirect link to wp-admin and new post
- Trying to login to my site redirects me to the first page
- stop customize.php redirect to login page if admin is not logged in
- Unable to log in as admin
- “Too many redirects” ONLY when trying to access wp-admin page
- Admin Page Redirect
- Unable to login and wp-login.php redirects to wp-admin%2F&reauth=1?
- How to redirect/rewrite all /wp-login requests
- Unable to login to my wordpress site. reauth=1 redirection loop
- Custom login redirects to wp-admin on wrong password
- How to allow users login to WP from external domain and make REST requests
- Wrong canonical link on wp-admin pages
- stop redirection on /wp-admin call to /wp-login
- wp-admin produces a 302 redirect to itself
- Unwanted redirect in admin area
- Login to wp-admin “redirect_to” points to wrong URL after migration
- Display sortable User meta column in admin panel user’s page
- How to move wp-admin login page to another location? [closed]
- wp-login.php — redirect logged in users to custom URL
- Can’t access wp-admin Internal Server Error 500
- Adding body class to login page?
- Edit a WordPress site without the username and password?
- comment_form – show all fields when logged in
- Change Dashboard url
- WordPress subdomain wp-admin redirects to main domain
- Using /wp-admin works, using /login gives a 404. Why?
- Cannot log into WordPress Dashboard after removing/adding .htaccess
- Change WP-Login or WP-Admin
- Why is there an intermediate redirect to https://public-url.org/wp-admin?
- I cannot log into my wordpress site with my wp-login.php [closed]
- Prevent /wp-admin/ from redirecting to homepage?
- How do I set the homepage to the WordPress Admin Dashboard login?
- Can’t access login screen, wp-login.php 404’s
- https://mydomain/wp-admin redirects to wp-login.php?redirect_to=https%3A%2F%2Fmydomain%2Fwp-admin%2F&reauth=1
- Can’t access WordPress as an admin – but I can log in as a user!
- Today, without warning, all admin panel logins redirect to home page after login. non-admin users logins work well
- Can’t login to Dashboard when changing site URL to HTTPS
- Detecting all admins that are logged in
- Redirect non-admin users away from wp-admin/index.php (main dashboard page) to wp-admin/profile.php
- WordPress and bbPress Login conflicts?
- I want to disable login of admin (/wp-admin) with email and make it accessible only with username
- Website looks fine, but login to wp-admin yields a blank screen
- cannot find the login page for local WordPress site
- Users disappeared from wp-admin
- Modify WP-Admin login fields
- display dynamic WP Site logo on wp-admin using CSS
- How to Change The WordPress Login URL Without Plugin
- WordPress (behind HAProxy and Jetty), not multisite, in sub folder – and /en/wp-admin/ keeps redirecting to /wp-admin/
- Created a new subdomain with same content. Should I add a redirect in my old subdomain?
- Logging into sandbox subdomain WP
- 404 redirect wp-login and wp-admin after changing login url [closed]
- Having troubles connecting to WordPress login page using Mamp
- Sorry, you are not allowed to access this page
- WP Admin/ WP Login Redirect to themselves
- wp-admin 302 redirects
- Too many redirects after added SSL redirect on port 80 virtual host
- Cookie Domain is preventing Admin login
- Require Login Redirect to Login Page
- Cannot access WordPress login pages
- Cant login to wp-admin
- /wp-admin/ doesn’t work but /admin/ does
- Why am I locked out of the system?
- Why can I log into wp-login.php and not wp-admin.php?
- Can’t access wp-admin, redirects to http://%24domain/wp-admin/
- Disable Admin CP authentication (or auto login)
- firing function at login within class
- WP-admin or any other is redirecting me to (This page doesn’t seem to exist.)
- Unable to properly login
- Restrict access to admin-post.php
- wp-login not found – All usual solutions not working
- how can provide access to wp_admin page for non wp_users?
- Redirect an entire WordPress site on a subdomain, except wp-admin
- Admin sometimes redirects to HTTPS
- Can’t connect to WP-Admin, blank error message
- Blank page when viewing wp-admin
- GoDaddy hosting wp-admin problem
- Too Many Redirects – WP-Admin Only
- define two login page url
- How to access wp-admin from original website after setting the domain redirect/forwarding
- WordPress /wp-admin redirect to wrong port in docker
- Login redirect_to url is pointing to a url with the port
- Login issue with subdomain installs
- Redirect from wp-admin back to page
- How can I can I make changes to a WP project I pulled from GItHub?
- Can’t access WP-Admin via HTTPS
- WordPress Admin Login Issue
- How to log into WordPress via GET/POST
- WordPress Admin login redirect to homepage
- Wp-admin Redirection loop after moving to subdirectory
- wp-login.php entering password nothing happens
- Avoid executing a function (redirect) if I’m in the admin area
- Admin Login Checks
- wp-admin redirects to standard wordpress page
- I cannot go to http://novathon.cloud.reply.eu/wp-admin – always redirected to /wp-login
- WordPress logged in but no access to wp-admin
- Changed the path to wp-login and now can’t access WPress dashboard