WordPress Fix: Locked Out of WordPress Admin? (wp-admin)

September 11, 2018

It’s never a pleasant feeling when something goes wrong with your website, especially when you can’t access the area that controls your site.

The WordPress admin (also known as wp-admin) is where the crux of your WordPress site controls lie. It’s where you upload media, create new pages and even control user accounts. But what happens when you attempt to login, only to be denied access to wp-admin.

We’ve seen a few cases where a user can login to WordPress, only to be redirected to the homepage – with no ability to access wp-admin.

OnePoint have helped WordPress site owners in Australia debug and fix this issue. While it’s not very common, it can happen to you so it’s always good to be prepared.

I can login but can’t access wp-admin

Unlike database connection errors, this issue can be tricky to narrow down the exact cause, but more often it is due to user permissions. To attempt this fix you’re going to need access to your SQL database – often accessed via phpMyAdmin. If you’re not comfortable making changes to your site’s database; simply give OnePoint a call on 07 3444 0045 and we can assist you.

phpmyadmin

Once you open phpMyAdmin and select your database, we will be making changes to the wp_users and wp_usermeta tables. Lets go ahead and click on wp_users table.

We need to insert our new admin user’s information, so click on the Insert tab like it shows in the image below.

wp-users-insert

In the insert form, add the following:

  • ID – pick a number or leave blank (in our example, we will leave it blank and the database will auto generate a number).
  • user_login – insert the username you want to use to access the WordPress Dashboard.
  • user_pass – add a password for this username. Make sure to select MD5 in the functions menu to encrypt the password.
  • user_nicename – put a nickname or something else that you would like to refer yourself as.
  • user_email – add the email you want to associate with this account.
  • user_url – this would be the url to your website, you can leave this blank if you wish.
  • user_registered – select the date/time for when this user is registered, you can leave this is default.
  • user_status – set this to 0.
  • display_name – put the name you like to display for this user on the site (it can be your user_nicename value as well).
  • Click on the Go Button

wp-users-insert-details-1

You will now see the newly created user with the assigned ID.

wp-users-user-created

Next we are going to have to add the values to wp_usermeta table. Click on the wp_usermeta table and then click on the Insert tab just like the previous step. Then add the following information to the insert form:

  • unmeta_id – leave blank (it will be auto-generated)
  • user_id – this will be the id of the user you created in the previous step. Remember in the previous screenshot, the outcome was the ID of 2.
  • meta_key – this should be wp_capabilities
  • meta_value – insert this: a:1:{s:13:”administrator”;s:1:”1″;}

Insert another row with the following information:

  • umeta_id – leave this blank (it will be auto-generated)
  • user_id – this will be the id of the user you created in the previous step. Remember we picked 4.
  • meta_key – this should be wp_user_level
  • meta_value – 10

wp-user-meta-insert

Click on the Go button and you have created yourself a new WordPress user with full admin access.

Now you should be able to login to your wp-admin with the username and password you specified for this user. Since you have full admin access, you will have the ability to make changes to other user roles. It’s handy to reset the faulty user roles by changing the user role (e.g. change to Subscriber) then click save. Once the page refreshes, change the user role back to admin and click save again.

If you’re locked out of your WordPress admin and need expert help, contact OnePoint online or call us on (07) 3444 0045.

Brisbane Based

30+ Years Experience

Software Experts

100% Local Team