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

Can’t access WordPress as an admin – but I can log in as a user!

You can check the user credentials in phpmyadmin by looking in the _usermeta table for a the meta_key column entry called wp_capabilities. Since you only have one user it will be the only entry. If you have more than one user, I’d guess you’re the user with ID 1 so match wp_capabilities column with user_id column entry “1” and see if the meta_value shows administrator. It’s serialized data so it will likely look like this: a:1:{s:13:"administrator";b:1;}.

If that is not the entry there, you can always replace the meta with the above line and try signing in. You should be admin at that point.

If you need to add a new user all together there are 2 easy ways to do this:

wp-CLI : wp user create newusername newuseremail --role=administrator --user_pass="newuserpass" --first_name=newuserfirst --last_name=newuserlast

Replace the newuser variables with your own info…

If you don’t have wp-CLI or are not sure how to use it, you can add this function to your theme’s functions.php and load the site once. It will create the user. Please make sure to remove this code after!!!

function rt_admin_account(){
  $user="";  //put username here
  $pass=""; //put pw here
  $email=""; //put email here
  if ( !username_exists( $user )  && !email_exists( $email ) ) {
    $user_id = wp_create_user( $user, $pass, $email );
    $user = new WP_User( $user_id );
    $user->set_role( 'administrator' );
  } 
}
add_action('init','rt_admin_account');

this creates a new user if that user doesn’t exist. If it doesn’t work change the username to something new and use a different email.

Related Posts:

  1. define two login page url
  2. After Upgrade: $user becomes unknown (id: 0) after successful login?
  3. How to redirect/rewrite all /wp-login requests
  4. Unable to login to my wordpress site. reauth=1 redirection loop
  5. Custom login redirects to wp-admin on wrong password
  6. How to allow users login to WP from external domain and make REST requests
  7. Only allow administrators and editors to access wp-admin
  8. Users are redirected to homepage instead of wp-admin
  9. Moving wordpress from localhost to server throws admin panel access error?
  10. Display sortable User meta column in admin panel user’s page
  11. How to move wp-admin login page to another location? [closed]
  12. Can’t access admin dashboard with wp-admin without /index.php after it
  13. Adding body class to login page?
  14. Edit a WordPress site without the username and password?
  15. comment_form – show all fields when logged in
  16. Using /wp-admin works, using /login gives a 404. Why?
  17. Cannot log into WordPress Dashboard after removing/adding .htaccess
  18. Change WP-Login or WP-Admin
  19. How to inhibit dashboard and profile management access to normal users?
  20. Only allow administrators and editors to access wp-admin
  21. I cannot log into my wordpress site with my wp-login.php [closed]
  22. How do I set the homepage to the WordPress Admin Dashboard login?
  23. Today, without warning, all admin panel logins redirect to home page after login. non-admin users logins work well
  24. Can’t login to Dashboard when changing site URL to HTTPS
  25. Detecting all admins that are logged in
  26. Redirect non-admin users away from wp-admin/index.php (main dashboard page) to wp-admin/profile.php
  27. WordPress and bbPress Login conflicts?
  28. I want to disable login of admin (/wp-admin) with email and make it accessible only with username
  29. Website looks fine, but login to wp-admin yields a blank screen
  30. admin_post action not usable if admin access denied to user
  31. cannot find the login page for local WordPress site
  32. Restrict Author role to only 3 wp-admin pages
  33. Users disappeared from wp-admin
  34. Modify WP-Admin login fields
  35. display dynamic WP Site logo on wp-admin using CSS
  36. How to Change The WordPress Login URL Without Plugin
  37. wp-admin – 404 after custom login form
  38. How to fix ‘WordPress redirection loop problem in wp-login.php page’?
  39. Logging into sandbox subdomain WP
  40. 404 redirect wp-login and wp-admin after changing login url [closed]
  41. Having troubles connecting to WordPress login page using Mamp
  42. Sorry, you are not allowed to access this page
  43. WP Admin/ WP Login Redirect to themselves
  44. Cookie Domain is preventing Admin login
  45. I can´t access my admin panel. I tried all possible solutions
  46. Require Login Redirect to Login Page
  47. Cannot access WordPress login pages
  48. Lost administrator privileges and can’t find a fix
  49. Cant login to wp-admin
  50. How to remove dashboard access (wp-admin) for author but not disable the capabilities?
  51. /wp-admin/ doesn’t work but /admin/ does
  52. Deploying WordPress for clients – what do they have access to?
  53. Why am I locked out of the system?
  54. Why can I log into wp-login.php and not wp-admin.php?
  55. Disable Admin CP authentication (or auto login)
  56. firing function at login within class
  57. WP-admin or any other is redirecting me to (This page doesn’t seem to exist.)
  58. How to Find The Email of a WP Admin Account
  59. wp-login not found – All usual solutions not working
  60. how can provide access to wp_admin page for non wp_users?
  61. Can’t connect to WP-Admin, blank error message
  62. Blank page when viewing wp-admin
  63. GoDaddy hosting wp-admin problem
  64. WP Admin Login keeps redirecting to login
  65. Is WordPress secure enough for a multi-user article directory?
  66. CPU overload spam – redirect link to wp-admin and new post
  67. Admin Page access
  68. Not able to access WP Admin, it says “Sorry, you are not allowed to access this page.”
  69. How to logout the current user without notices and warnings?
  70. Login issue with subdomain installs
  71. How can I can I make changes to a WP project I pulled from GItHub?
  72. WordPress Admin Login Issue
  73. How to log into WordPress via GET/POST
  74. restrict admin panel sections to users
  75. wp-login.php entering password nothing happens
  76. Trying to login to my site redirects me to the first page
  77. stop customize.php redirect to login page if admin is not logged in
  78. Admin Login Checks
  79. WordPress logged in but no access to wp-admin
  80. Changed the path to wp-login and now can’t access WPress dashboard
  81. Unable to log in as admin
  82. Why my login panel has a wrong language?
  83. Handling multiple account logins?
  84. Not able to access WP admin Page, redirected and a drop down login menu appears 401 error
  85. Localhost install: Administrator lost administrator access; cannot access Dashboard
  86. WordPress Login for multiple sites
  87. Cannot login in WordPress even after changing hash password in phpmyadmin
  88. Can’t log into WordPress after domain change
  89. Why WordPress not logout after I have close my browser?
  90. is_admin() conditional statement
  91. Admin Login page not working at all
  92. Impossible User Registration
  93. Couple questions about .htaccess, login page, updates
  94. WordPress blog fails to open
  95. Is it possible to tell if a user is logged into WordPress from looking at the cookies which are set?
  96. Redirect users based on their roles, is_admin()
  97. WordPress site shows a white page for site/wp_admin. A login returns again to the login screen
  98. Admin access to secondary site user_can_access_admin_page losing login
  99. login_enqueue_scripts changes are not reflecting
  100. How to restrict dashboard access to Admins only?
Categories wp-admin Tags login, user-access, wp-admin
How can we redirect user from login page to home page if user is logged in WordPress?
Improve wp query perfomance on large db

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