[RESOLVED]: Wordpress Error “You do not have sufficient permissions to access this page”

[RESOLVED]: Wordpress Error “You do not have sufficient permissions to access this page”

Either by changing a theme, updating a plugin, or changing your hosting provider can potentially throw one error or another. This is even when you’ve provided the correct credentials. While this WordPress error can be overwhelming, fixing it isn’t tough.

What causes the error?

This error is a bit intriguing since it doesn’t provide any clues as to what caused the error. Even when trying to log in as an administrator into your WP dashboard, you see a page stating lack of permission to view the page. So you wouldn’t even be able to navigate into any other page. This is common to both WordPress and WooCommerce.

But what’s the origin of this error? Well, to put it simply WordPress wasn’t able to retrieve the roles and responsibilities of your WP account from the database. So, by nature, it presumes that you (or anyone else) do not have permission at all. This problem is common when you move to another provider. So if you experience the same, there’s nothing to worry, you can fix it on your own with few edits.
error2.jpg


Fixing the Sufficient Permission Error

To fix this error, you need to look into the wp-config file. Look for the database prefix setting section which should look something like this:
Code:
/**
* WordPress Database Table prefix.
*
* You can have multiple installations in one database if you give each a unique
* prefix. Only numbers, letters, and underscores please!
*/
$table_prefix = 'wp_';
The thing to note about the “$table_prefix” database prefix is that it is not only for table prefixes, but for other field prefix as well.

Few WordPress developers change this “$table_prefix” for a variety of reasons. If this is done during the installation process, then you aren’t likely to get any error. But the permission error surfaces when you migrate your website or change the prefix after installation.

Edit the Prefixes using phpMyAdmin

The first thing you need to do is check for the prefixes and edit them appropriately. To do this, you need to log in to your new cPanel. Then follow the steps:
  • Launch phpMyAdmin from the Database section
database1.png

  • Select WordPress MySQL database. Or select the website mentioned in wp-config file with field “’DB_NAME’,’wpdb’”. This will open up all the tables in your database
  • The tables should be prefixed with wp_
  • From the list of tables, click on “wp_usermeta”
  • Find the “meta_key” column and change the prefixes from “wp_” to match those configured in your wp-config file:
  • wp_capabilities
  • wp_user_level
  • wp_user-settings
  • wp_user-settings-time
  • wp_dashboard_quick_press_last_post_id
database2.png

  • If you’ve got multiple users, you need to change the same for each user
Using MySQL commands

The other way you can do this is by using MySQL commands. This is ideal for those who prefer to work with CLI. Follow the steps:
  • Log in to your MySQL with this command: mysql -host localhost -u root -p
  • Select the appropriate database with the command: Use wpdb
  • Now run the commands to change the prefix, in this case from wp_usermeta to Ars51:
Code:
UPDATE  `wpdb`.`wp_usermeta` SET  `meta_key` =  'Kyp51_capabilities' WHERE  `wp_usermeta`.`umeta_id` =10;
UPDATE  `wpdb`.`wp_usermeta` SET  `meta_key` =  'Kyp51_user_level' WHERE  `wp_usermeta`.`umeta_id` =11;
UPDATE  `wpdb`.`wp_usermeta` SET  `meta_key` =  'Kyp51_user-settings' WHERE  `wp_usermeta`.`umeta_id` =14;
UPDATE  `wpdb`.`wp_usermeta` SET  `meta_key` =  'Kyp51_user-settings-time' WHERE  `wp_usermeta`.`umeta_id` =15;
UPDATE  `wpdb`.`wp_usermeta` SET  `meta_key` =  'Kyp51_dashboard_quick_press_last_post_id' WHERE  `wp_usermeta`.`umeta_id` =16;
Before changing the value, you might have to check the value of each row using the command:

Code:
select * from wp usermeta where umeta id=10;
Doing this should fix the issue and you’d be able to log in to your WordPress dashboard successfully.
Author
bhawanisingh
Views
11,415
First release
Last update
Rating
0.00 star(s) 0 ratings
Top