WordPress “You don’t have permission to do that” error

If you have a fresh install of WordPress with plugins deactivated and no special tweaks, it most certainly should not be telling you that you don’t have permission to do things. If it does:

This is a javascript error. I noticed the glitch when I was trying to create new categories – which is an Ajax function. A helpful user on the WordPress forums discovered the solution:

Go into your wp-includes/pluggable.php file. Find this code, or something very similar to it (mine was slightly different, but most of the lines were exact). Now, make a copy of this file before you proceed, because then if it screws something up horribly, you can fix it.

$cookie = explode('; ', urldecode(empty($_POST['cookie']) ? $_GET['cookie'] : $_POST['cookie'])); // AJAX scripts must pass cookie=document.cookie
foreach ( $cookie as $tasty ) {
if ( false !== strpos($tasty, USER_COOKIE) )
$user = substr(strstr($tasty, '='), 1);
if ( false !== strpos($tasty, PASS_COOKIE) )
$pass = substr(strstr($tasty, '='), 1);
}

Replace it with:

$user = $_COOKIE[USER_COOKIE];
$pass = $_COOKIE[PASS_COOKIE];

One Response to “WordPress “You don’t have permission to do that” error”

  1. [...] while back, I posted a fix for the “You Don’t Have Permission to do that” error that WordPress 2+ sometim… etc. My fix involved editing a core file, which not every user is comfortable doing (and you have [...]

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Don't miss an article!

 Subscribe in a reader or get every article delivered by email