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 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
- 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
- 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?
- 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
- Detecting all admins that are logged in
- 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]
- Sorry, you are not allowed to access this page
- 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 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
- 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
- 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
- wp-admin redirects to standard wordpress page
- 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?
- Handling multiple account logins?
- Not able to access WP admin Page, redirected and a drop down login menu appears 401 error
- Cannot login in WordPress even after changing hash password in phpmyadmin
- Can’t log into WordPress after domain change
- Why WordPress not logout after I have close my browser?
- Admin user getting redirected to /wp-admin/user
- is_admin() conditional statement
- Admin Login page not working at all
- How can visitors redirect wp-admin to the homepage?
- Couple questions about .htaccess, login page, updates
- Why when I click on a link into the WP admin panel I am redirected to a link that doesn’t contains wp-admin prefix, so I obtain 404 error
- After Upgrade: $user becomes unknown (id: 0) after successful login?
- Redirect users based on their roles, is_admin()
- WordPress site shows a white page for site/wp_admin. A login returns again to the login screen