Fix WordPress You Do Not Have Sufficient Permissions to Access This Page

WordPress Logo and Words "Fix WordPress You Do Not Have Sufficient Permissions to Access this Page"

Are you getting the WordPress error “You do not have sufficient permissions to access this page” error over and over no matter what you try. I’m sorry to hear it and hope this post helps!

Fix WordPress You Do Not Have Sufficient Permissions to Access This Page

There are dozens of blog posts with excellent solutions to this problem.

But if you’ve been at WordPress for any length of time, you’ve probably discovered that many of the hacks and tweaks that work for others just don’t fix your problem. It’s happened to me, too.

A while ago I created a local installation of a WordPress site using Bitnami.

But no matter what I did, I kept getting the dreaded WordPress “You do not have sufficient permissions to access this page.

I knew it was a database permissions problem, but I just couldn’t get the right combinations of tweaks to work. The problem turned out to be incomplete WordPress admin user data because of corrupt tables.

I finally came up with the manual procedure that fixed my particular problem. Those troubleshooting steps are listed in Option 2 below.

Option 1 explains how to use MySQL to add an admin record.

But first, you might want to try using a different browser.

A reader recently posted that he was getting this error with Firefox but was able to access his site using a different browser. Browser caching can definitely cause problems like this, so it’s a great tip to try first.

If that doesn’t help, try either of the following options:

Option 1. Use MySQL Code to Insert Administrative-Level Access

Refer to this short post that shows how to use MySQL to insert a WordPress admin user.

If you have access to your database, the code will give you administrator-level access to your WordPress installation. 

Create a backup of your WordPress site first. Then carefully follow the author’s instructions. Once done, you should be able to log in with administrative access.

If that does not resolve your access problems, please refer to the following manual steps in troubleshooting:

Option 2. Manual Procedure to Troubleshoot Administrative Access Problems

1. Make sure you have completely downloaded from the server all files and folders including wp-admin, wp-content, wp-includes.

2. Open your wp-config.php file and make sure to define the following variables correctly in your wp-config.php. These variable values must match the objects’ values in phpMyAdmin database and tables as follows:

define(‘DB_NAME’, ‘test‘); –  must match db name in database
define(‘DB_USER’, ‘admin‘);  – must match admin user name  in wp_users
define(‘DB_PASSWORD’, ‘password‘);  – must match admin password  in wp_users
define(‘DB_HOST’, ‘localhost‘);  – ‘localhost’ value will point to local server

3. Launch phpMyAdmin for the local site and find the correct database. In this example, it is the ‘test’ database.

phpAdmin-database-screen1

4. Make sure the  wp_usermeta and wp_users tables exist:

phpAdmin-database-screen2

Somehow these tables were corrupt.  Bear with me here. This is the nuts and bolts issue that I was having with my local installation.

5. Open the wp_users table and check these 2 things:

  • You need to have an admin record in wp_users table.
  • Admin record user_login and user_pass columns must match the values in the wp-config.php file:

define(‘DB_USER’, ‘admin‘);
define(‘DB_PASSWORD’, ‘password‘);

6.  Open the wp_usermeta table:

  • Make sure that the wp_usermeta table has an admin record whose user_id matches the admin ID record in wp_users.
  • Check the wp_capabilities column for admin and make sure the value is set to: a:1:{s:13:”administrator”;s:1:”1″;}.
  • Check the wp_user_level column for admin and make sure the value is set to: 10.

How the Tables Should Look

The screenshot below shows the correct configuration. Note that wp_usermeta has an admin user with a user_id = 1. Note that wp_user also has an admin user with a user_id = 1.

phpMyAdmin_tables

Related Tables were Corrupt

My problem was that in the local installation the wp_users table was missing admin ID = 1 which was required as that is the admin ID in wp_usermeta.

Since there were multiple user entries in the wp_users table, I deleted all of the other users in order to simplify testing all of this.

Then I manually inserted a new admin record into wp_users with an ID = 1. If you do this, make sure you encrypt the password when adding the record. You do that by setting the function column to “MD5”. See below:

md5

Once done I was able to login and access the dashboard.

I encourage you to try the above procedure if you have tried other solutions and still receive the WordPress “You do not have sufficient permissions to access this page.”

It’s nitty-gritty database stuff, but if you can get to the tables through phpMyAdmin, you should be able to fix the columns so that everything required by WordPress is there. All it takes is one value to be missing or incorrect.

Faulty Plugins

New releases of WordPress can cause a fair share of plugin issues for many WordPress users.

In working with a new client who was locked out of the admin area due to permissions problems, we discovered that the iThemes Security (formerly Better WP Security) broke after WordPress was upgraded.

When trying to access WP-Admin via the plugin’s interface, the Better WP Security plugin script threw an error.

We were also locked out of the normal WP-Admin access with the “You do not have sufficient permissions to access this page” error because the login was redirected through Better WP Security’s interface, which was broken.

The fix is fairly straightforward. To test for a broken plugin, you can log into ftp or cpanel and rename the plugin or delete it altogether. 

Once done, the scripting error was solved, but we still could not log into the admin area using the plugin’s interface.

We  were, however, able to access WP-Admin through the default interface. The permissions error was solved when the faulty plugin was deleted. Finally the WordPress login screen became available to us.

So definitely try removing faulty plugins one by one before resorting to a database restore.

I hope this post helps you fix the “WordPress You Do Not have Sufficient Permissions” error.

Print Friendly, PDF & Email

Similar Posts