Skip to content
Advertisement

Deleted all cookies on wordpress.com now I am getting logged out

I wanted to delete all cookies on my wordpress.com website so that one of my popups should continue appearing. This is the code that I wrote in my function.php file:

if (isset($_SERVER['HTTP_COOKIE'])) {
    $cookies = explode(';', $_SERVER['HTTP_COOKIE']);
    foreach($cookies as $cookie) {
        $parts = explode('=', $cookie);
        $name = trim($parts[0]);
        setcookie($name, '', 3600000);
        setcookie($name, '', 3600000, '/');
    }
}

After I saved this I kept on getting logged out of WordPress because I had deleted all my cookies.

I tried removing it from functions.php and saving the file but then I received the following errors:

Something went wrong. Your change may not have been saved. Please try again. There is also a chance that you may need to manually fix and upload the file over FTP.

or:

nonce_failure

I have tried searching in WordPress blogs but have not found anything, any help would be appreciated.

Advertisement

Answer

The website was wordpress.org and not wordpress.com, so to fix the error I went to my web host used their file manager and updated the file from there.

All wordpress.org websites should have an option to do this, unlike wordpress.com. This is because wordpress.com is shared hosting so there are no FTP accounts or anything similar, however, you shouldn’t be able to edit a functions.php file if it is shared hosting.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement