Skip to content
Read For Learn
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP

Admin access to secondary site user_can_access_admin_page losing login

So, Why is the value of the function TRUE on init and at some point
during the event lifecycle this changes to false?

The answer to this (and effectively the question) is to do with WP Capabilities.

  1. Firstly: Certain WP functions are available at different times in
    the action cycle (
    https://codex.wordpress.org/Plugin_API/Action_Reference )
  2. Secondly: The cookie works and does pickup the correct user/ID and role
    (administrator) so is_user_logged_in() and is_admin() are available.
  3. Thirdly: The capabilities are not defined because of the difference
    in WP Table Prefix.

The solution to this problem is to make sure capabilities are set correctly.
This means that the TABLE_PREFIX needs to be mapped for each user referencing the second database.

This action is performed on DB aaa (the primary/first) acting as the authenticator.

Table aaa.PREFIXA_user_meta => meta_key='PREFIXA_capabilities'
Copy this Row and re-label the meta_key to PREFIXB_capabilities'

This effectively allows admin access to those users linked on aaa.

Notable links that helped get to the answer:

https://stackoverflow.com/questions/30112158/wordpress-wp-admin-you-do-not-have-sufficient-permissions-to-access-this-page

https://stackoverflow.com/questions/70792336/wordpress-dashboard-sorry-you-are-not-allowed-to-access-this-page-after-movi

Related Posts:

  1. How to redirect/rewrite all /wp-login requests
  2. Unable to login to my wordpress site. reauth=1 redirection loop
  3. Custom login redirects to wp-admin on wrong password
  4. How to allow users login to WP from external domain and make REST requests
  5. Users are redirected to homepage instead of wp-admin
  6. Display sortable User meta column in admin panel user’s page
  7. How to move wp-admin login page to another location? [closed]
  8. Can’t access admin dashboard with wp-admin without /index.php after it
  9. Adding body class to login page?
  10. Edit a WordPress site without the username and password?
  11. comment_form – show all fields when logged in
  12. Using /wp-admin works, using /login gives a 404. Why?
  13. Cannot log into WordPress Dashboard after removing/adding .htaccess
  14. Change WP-Login or WP-Admin
  15. I cannot log into my wordpress site with my wp-login.php [closed]
  16. How do I set the homepage to the WordPress Admin Dashboard login?
  17. Can’t access WordPress as an admin – but I can log in as a user!
  18. Today, without warning, all admin panel logins redirect to home page after login. non-admin users logins work well
  19. Can’t login to Dashboard when changing site URL to HTTPS
  20. Detecting all admins that are logged in
  21. WordPress and bbPress Login conflicts?
  22. I want to disable login of admin (/wp-admin) with email and make it accessible only with username
  23. Website looks fine, but login to wp-admin yields a blank screen
  24. cannot find the login page for local WordPress site
  25. Users disappeared from wp-admin
  26. Modify WP-Admin login fields
  27. display dynamic WP Site logo on wp-admin using CSS
  28. How to Change The WordPress Login URL Without Plugin
  29. wp-admin – 404 after custom login form
  30. How to fix ‘WordPress redirection loop problem in wp-login.php page’?
  31. Logging into sandbox subdomain WP
  32. 404 redirect wp-login and wp-admin after changing login url [closed]
  33. Having troubles connecting to WordPress login page using Mamp
  34. Sorry, you are not allowed to access this page
  35. WP Admin/ WP Login Redirect to themselves
  36. Cookie Domain is preventing Admin login
  37. Require Login Redirect to Login Page
  38. Cannot access WordPress login pages
  39. Cant login to wp-admin
  40. /wp-admin/ doesn’t work but /admin/ does
  41. Why am I locked out of the system?
  42. Why can I log into wp-login.php and not wp-admin.php?
  43. Disable Admin CP authentication (or auto login)
  44. firing function at login within class
  45. WP-admin or any other is redirecting me to (This page doesn’t seem to exist.)
  46. wp-login not found – All usual solutions not working
  47. how can provide access to wp_admin page for non wp_users?
  48. Can’t connect to WP-Admin, blank error message
  49. Blank page when viewing wp-admin
  50. GoDaddy hosting wp-admin problem
  51. WP Admin Login keeps redirecting to login
  52. CPU overload spam – redirect link to wp-admin and new post
  53. define two login page url
  54. Login issue with subdomain installs
  55. How can I can I make changes to a WP project I pulled from GItHub?
  56. WordPress Admin Login Issue
  57. How to log into WordPress via GET/POST
  58. wp-login.php entering password nothing happens
  59. Trying to login to my site redirects me to the first page
  60. stop customize.php redirect to login page if admin is not logged in
  61. Admin Login Checks
  62. WordPress logged in but no access to wp-admin
  63. Changed the path to wp-login and now can’t access WPress dashboard
  64. Unable to log in as admin
  65. Why my login panel has a wrong language?
  66. Handling multiple account logins?
  67. Not able to access WP admin Page, redirected and a drop down login menu appears 401 error
  68. WordPress Login for multiple sites
  69. Cannot login in WordPress even after changing hash password in phpmyadmin
  70. Can’t log into WordPress after domain change
  71. Why WordPress not logout after I have close my browser?
  72. is_admin() conditional statement
  73. Admin Login page not working at all
  74. Impossible User Registration
  75. Couple questions about .htaccess, login page, updates
  76. After Upgrade: $user becomes unknown (id: 0) after successful login?
  77. Redirect users based on their roles, is_admin()
  78. WordPress site shows a white page for site/wp_admin. A login returns again to the login screen
  79. login_enqueue_scripts changes are not reflecting
  80. Disable dragging of meta boxes?
  81. Toggle admin metabox based upon chosen page template
  82. Unable to login and wp-login.php redirects to wp-admin%2F&reauth=1?
  83. My wordpress site gets redirected automatically to the old site any known solution for this?
  84. Use a different domain for SSL
  85. Adding a menu item in the admin bar
  86. How to disable 3.3 Tooltips?
  87. wp login redirects to homepage
  88. Displaying which Role the current user is assigned to
  89. submit for review issue
  90. wp-admin does not redirect to dashboard
  91. Custom roles showing HTML entities in title form field
  92. How can I remove the user avatar from admin toolbar?
  93. How to stop – Database Update Required – from happening again?
  94. using wp_sprintf at wordpress option page,
  95. Disable wordpress reordering functions in backend screen element
  96. WordPress server change – slow admin login time for first time
  97. Move Custom Taxonomy Menu to Top Level Admin Menu
  98. Extend user search in the users.php page to allow for searching by role and excluding specified email domains from the “users search” input box
  99. Is it possible to hide or encrypt the display name after login into the WordPress admin panel?
  100. Error 403 on wp-admin – Redirection to upgrade.php
Categories wp-admin Tags login, wp-admin
Resolving Google Search Console Error: Video Too Tall for Embedded YouTube URLs
Display featured posts first, then display all others within a specific category in WordPress

Recommended Hostings

Cloudways: Realize Your Website's Potential With Flexible & Affordable Hosting. 24/7/365 Support, Managed Security, Automated Backups, and 24/7 Real-time Monitoring.

FastComet: Fast SSD Hosting, Free Migration, Hack-Free Security, 24/7 Super Fast Support, 45 Day Money Back Guarantee.

Recent Added Topics

  • Bug in translation system: load_theme_textdomain() returns true, files are available and accessible but the language defaults to english
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • Get the name of the template/*html file used
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
  • How to display the description of a custom post type in the dashboard?
  • Critical error on image display
  • Copying WP data and files into new install?
  • How to determine the DirectAdmin WordPress backup date?
  • How to get list of ALL tables in the database?
© 2026 Read For Learn
  • Database
    • Oracle
    • SQL
  • algorithm
  • asp.net
  • assembly
  • binary
  • c#
  • Git
  • hex
  • HTML
  • iOS
  • language angnostic
  • math
  • matlab
  • Tips & Trick
  • Tools
  • windows
  • C
  • C++
  • Java
  • javascript
  • Python
  • R
  • Java Script
  • jQuery
  • PHP
  • WordPress