We love WordPress here at Kino Creative, but such a large CMS platform is bound to develop the occasional niggle. If you can’t login to the administration panel then your first port of call should be the WordPress Codex. Unfortunately although the solution worked for us, it didn’t address the underlying problem.

We love WordPress here at Kino Creative, but such a large CMS platform is bound to develop the occasional problem. If you can’t login to wp-admin, the administration panel, then your first port of call should be the WordPress Codex. Unfortunately although the solution worked for us, it didn’t address the underlying problem.

Our problem is that occasionally on our various WordPress sites the wp-admin.php URL login stops working and we can only login through wp-login.php. We tried all the fixes and tracked it down to an issue with cookies.

Clearing the browser’s cookies might let us login again but to be honest it’s a pain, and clearing your cookies isn’t a permanent fix. We have found a solution though, and it’s thanks to freelancer Richard Telford, PHP guru of unparalleled guile and intelligence, and all round king of code!

What we need to do is to force WordPress to follow the correct cookie path. This can be done by adding a small line of code to the wp-config.php file located in your WordPress installation root directory.

Force WordPress to follow the correct cookie path

Open up wp-config.php in your web editor and it should look something like this:

<?php
/**
* The base configurations of the WordPress.
*
* This file has the following configurations: MySQL settings, Table Prefix,
* Secret Keys, WordPress Language, and ABSPATH. You can find more information by
* visiting {@link http://codex.wordpress.org/Editing_wp-config.php Editing
* wp-config.php} Codex page. You can get the MySQL settings from your web host.
*
etc...

Add the following code somewhere in the file:

/** wp-admin login fix */
@define('ADMIN_COOKIE_PATH', '/');

If you’re unsure, it can go just before the ?> at the end of the php code like so:

/** Sets up WordPress vars and included files. */
require_once(ABSPATH . 'wp-settings.php');
/** wp-admin login fix */
@define('ADMIN_COOKIE_PATH', '/');
?>

Hopefully now you will now be able to login again!

If you have a WordPress installation and can’t login to wp-admin but can login to wp-login.php then this fix might work for you too. This may only be a problem on Windows servers and we certainly won’t be held responsible if your website implodes following our instructions!