Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

You do not have sufficient permissions to access this page without any change [closed]

Tags:

I am working on Wordpress and I completed my project locally. I then moved it to my live server and did not change anything, I just made changes in the config file (database name, username and password).

Now my site is working fine on the front-end but I can't get access to the admin panel as every time it gives me the error message:

You do not have sufficient permissions to access this page.

Google searches indicate that most of the errors occurred due to a change in the prefix but in my case its the same as on local. Also, the permissions of my directories are 755 and that of files is 644 but still am facing the same issue.

How might I go about fixing this?

like image 468
Kashif Waheed Avatar asked Dec 11 '12 07:12

Kashif Waheed


People also ask

Why do I get the error “you do not have sufficient permissions?

The WordPress error You do not have sufficient permissions to access this page is typically encountered when trying to access the WordPress dashboard or admin pages after you have changed the WordPress database table prefix, or moved WordPress from one hosting provider to another, or just upgraded your WordPress.

Why can’t I access the admin page?

Reason: There You do not have sufficient permissions to access this admin page. Reason: There You do not have sufficient permissions to access this admin page. Reason: There is a hidden menu item with the same URL (index.php) but a higher priority.

How to fix WordPress permission presumed to be without permission?

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. To fix this error, you need to look into the wp-config file.

Why can't I access certain directories in a directory?

Your problem is not with permission on directories. The fact that you see a "You do not have sufficient permissions to access this page" message means three things : the area you are trying to access is reserved for a higher level of user (so you might be connecting with an editor account whereas the area is only accessible to administrators).


1 Answers

Have you changed the prefix of your database tables? I'm 90% sure, that this is your problem.

The thing is that WordPress uses the $table_prefix variable for forming the option and usermeta keys names, where it's storing the roles and capabilities information. So once you change the prefix, but don't update your db, you get this error. Here's how to fix it - execute this SQL command through phpMyAdmin, or a different interface for interacting with your DB(you can do it with PHP as well):

UPDATE `{%TABLE_PREFIX%}usermeta` SET `meta_key` = replace(`meta_key`, '{%OLD_TABLE_PREFIX%}', '{%NEW_TABLE_PREFIX%}');
UPDATE `{%TABLE_PREFIX%}options` SET `option_name` = replace(`option_name`, '{%OLD_TABLE_PREFIX%}', '{%NEW_TABLE_PREFIX%}');

Where:

  • {%TABLE_PREFIX%} is your current $table_prefix(as set in wp-config.php)
  • {%OLD_TABLE_PREFIX%} is your previous $table_prefix
  • {%NEW_TABLE_PREFIX%} is your new(current) $table_prefix - it will most-likely be the same as your {%TABLE_PREFIX%}.

So if your old $table_prefix was wp_test_ and your new one is wp_, you would do this query:

UPDATE `wp_usermeta` SET `meta_key` = replace(`meta_key`, 'wp_test_', 'wp_');
UPDATE `wp_options` SET `option_name` = replace(`option_name`, 'wp_test_', 'wp_');

EDIT: As @Francisco Corrales noted, if you are having troubles accessing an admin page that you created(if you don't write PHP, this is not your case), you can check out this link: Wordpress Error while developing a plugin -"You do not have sufficient permissions to access this page."


EDIT 2: As @Kasper Souren noted, you might want to add a WHERE clause to the options UPDATE query. Like so(don't remove the % after the last %}):

UPDATE `{%TABLE_PREFIX%}options` SET `option_name` = replace(`option_name`, '{%OLD_TABLE_PREFIX%}', '{%NEW_TABLE_PREFIX%}') WHERE option_name like '{%OLD_TABLE_PREFIX%}%';
like image 173
Nikola Ivanov Nikolov Avatar answered Sep 22 '22 17:09

Nikola Ivanov Nikolov