Recently, I had upgrade to word press 2.2.3 version and get rid of old word press non widget version. Everything was working fine as before except i was unable to add new category in the post. Every time word press deny access with the message “You don’t have permission to do that“. A little googling later, i found fix for the issue but i am not sure about the correctness of the fix. It may not work with other installation but at last it has fixed my problem. The error is due to incorrect parsing of cookie and check_ajax_referer will return false value instead of correct value.

How to Fix

Find code below in the wp-includes/pluggable.php file and replace with the code given below this code. Make a backup of file before doing any change.

Find Code Below:

$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 with the above code.

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

Written by Bala Krishna

Bala Krishna is web developer and occasional blogger from Bhopal, MP, India. He like to share idea, issue he face while working with the code.