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