Logged into wordpress and greeted by “You do not have sufficient permissions to access this page”Apr 11th, 2012 | By admin | Category: wordpress
In the words of Dom, one of my favorite Bondi Hipsters: “Well this is Awks”.
I was doing some redesigning and upgrading of wordpress for a client of mine and to make the process a lot easier and faster I setup a temp version of the site on my server where I didn’t have to deal with the utter nonsense of cpanel. So got the site where the client was happy, nay thrilled with the results and moved it back to her server. Site setup went great, the frontend works flawlessly but after successfully loggin into the admin area I was greeted with the following error message:
You do not have sufficient permissions to access this page.
Also known as awesome-sauce to any wordpress admin. GGGAAAAAHHHHHHHH and now it just won’t fucking go away so I’m going to just blog about everything god damn solution I am trying out here.
First a little trick if you find yourself in this situation and need to log out of the admin area but have no logout button handy. Go here: https://api.wordpress.org/secret-key/1.1/salt/ and copy the contents of that page and replace the equivalent keys in your wp-config.php file with them.. This will log out all users.
Now as per the solutions I’ve found:
- Turn on Debug Mode: Go into your wp-config.php file and search for ‘debug’ , you should find a line that has a variable of false.. Change that to true and see if you get anything more informative in terms of error messages that point you in the right direction to solve your problem
- Prefix problems: The most common one by far seems to be changing the table prefix. I guess sometimes people move the site from one database with the default _wp prefix to somewhere else that doesn’t have this prefix in the table. this is easy enough, just go into the wp-config.php file and find the prefix setting and change it to whatever prefix you are seeing when looking at the DB in phpmyadmin or whatever. You should note that case matters here so if your config file says Wp_ and your database says wp_ that’s not going to fly, the case of all the letters needs to be identical. But of course this isn’t my problem so onto the next!
- .HTACCESS: The second solution is something to do with the .htaccess file. Now this got me the most excited as I actually did edit the .htaccess file so it wouldn’t forward everyone back to her old url and I could work on the tmp version on a subdirectory of my hostyourworld.com domain. Of course after reverted to the original again this didn’t do a god damn thing.
- Force a DB upgrade: This is kind of cool to know how to do actually, regardless of if it does fuck all for my problem. Go into your database and into wp_options yuo should find ‘db_version’ . and it should probably be something like 19470 or something if you aren’t operating a version of WP from the bronze age. Change it to 8204 or something like that and then reload the wp-admin/ page and you’ll be prompted to do a DB upgrade.. Sometimes this resets problematic settings and fixes everything. Well it does for normal people, I’m a freak you see, the special kind of freak that needs to try 9432 solutions before stumbling upon the one that actually applies to him
- A plugin or theme problem: Create a new directory in wp-content called bak_plugs and move all the plugins in the plugins/ directory into there and see if you can access your dashboard now. If you can then move the plugins back one at a time, refreshing the dashboard after each one to narrow down the problem. If it wasn’t the plugins then try to rename the directory of whatever theme you are using (ie: themes/yourtheme/) to something else, forcing WP to use the default theme.
- Yummy Cookies: Delete all of your cookies and/or try to login from another browser.
- Edits to wp-config or wp-settings file: Have you made any additions to these files recently? If so go remove those additions and see if that fixes it. If it does you’ll have to find another way to accomplish what you were trying to accomplish
And the solution to my problem WWWASSSSS:
HUMAN ERROR: So before I moved the site to the clients server I went into and did a global search replace with sed on the the dumped sql file to replace the paths on my server with the new paths on the clients server.. so for example /home/hosting/example/domain/ was supposed to be replaced with /path/to/site/on/clients/server/
it was missing a bloody trailing slash. GAH! So go through your dumped .sql file with the fine tooth comb and make extra sure nothing is screwed up there.