No Admin Access to my site in Local

What issue or error are you experiencing?

I imported a site in Local with a ZIP file. The site is displayed correctly but when I try to login using my Admin User with correct User and Password, I can login to Wordpress but there’s no Dashboard, it seems the User is not seen as an Admin, while in the original site it was (One Admin only user was set).

I’ve seen this problem reported before but the solutions suggested elsewhere didn’t solve the problem for me. I suspect a user privilege conflict but I do not know how to fix it.

System Details

  • **Local Version: Version 9.0.3+6684

  • **Operating System (OS) and OS version: MacOS Sonoma 14.5


Local Logs

Attach your Local Logs here (Help Doc - Retrieving Local’s Log)

local-logs.zip (28.3 KB)


Security Reminder
Local does a pretty good job of scrubbing private info from the logs and the errors it produces, however there’s always the possibility that something private can come through. Because these are public forums, always review the screenshots you are sharing to make sure there isn’t private info like passwords being displayed.

You could try creating a new admin user via WP-CLI. It should at least give you admin permissions to explore the dashboard and check the level and privileges of the other user.

  1. Start Local and your site.
  2. Click Open Site Shell.
  3. Type this, replacing the values in brackets with your own (but omitting the brackets):
    wp user create [username] [email] --user_pass=[password] --role=administrator
    

Log in as the user you created, who should have admin access.

From there you could check the user’s current level, as well as their WP capabilities using a plugin. Or delete that user and re-assign any posts they made to your new admin user.

Thank you nickc, I tried but when I click on Open Site Shell, a normal Terminal window opens on Mac on root path… and the above command does not work (zsh: command not found: wp). Am I missing something?

Thanks
Andrea

Sorry to hear that, @andymerlino. The normal Terminal window is expected, but you should see output like this once it opens:

Setting Local environment variables...
----
WP-CLI:   WP-CLI 2.9.0
Composer: 2.6.2 2023-09-03
PHP:      8.1.23
MySQL:    mysql  Ver 8.0.16 for macos10.14 on x86_64 (MySQL Community Server - GPL)
----
Launching shell: /bin/zsh ...

If you see something else, it’s worth temporarily commenting out any modifications to your shell config (for example, in ~/.zshrc), closing the Terminal, and trying again.

I think I’ve understood that WP-CLI is an environment that must be installed, so I finally managed to do it using home-brew, and then try to create a user as suggested, but got other error Error: ‘wp-config.php’ not found… I guess using the terminal is not my thing… thank you anyway

Sorry you ran into this, @andymerlino. You shouldn’t have to install WP-CLI separately as it’s bundled with Local. It seems there’s an issue with the shell environment that’s preventing WP-CLI from working by default for you, though.

Another way you could try to create an admin user is by making a database edit:

  1. Start your site in Local.

  2. Click the “Database” tab and then “Open AdminerEvo”.

  3. Click the “wp_users” table.

  4. Click “New Item” and use these values (very important to select md5 for the user_pass field before entering a password):

  5. Click Save.

  6. Click wp_usermeta from the sidebar.

  7. Click “New Item”.

  8. Fill these values:

    • umeta_id: (this can be empty)
    • user_id: 123 (this must be the same as the ID value you entered in step 4.)
    • meta_key: wp_capabilities
    • meta_value: a:1:{s:13:"administrator";b:1;}
  9. Click “Save and insert next”.

  10. Fill these values:

    • umeta_id: (this can be empty)
    • user_id: 123 (this must be the same as the ID value you entered in step 4.)
    • meta_key: wp_user_level
    • meta_value: 10
  11. Click “Save”.

  12. Return to Local and click “WP Admin” to visit your site’s admin page.

  13. Try to log in with “newadmin” and “newpass”, or whatever values you filled for user_login and user_pass in step 4.

You should now be logged in as an admin user.

If you push the database to a production site, be sure to change this new user’s password first to something other than the value above, or delete this temporary admin user.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.