WordPress: Can’t Login To wp-admin

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:

* 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.

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!



I have just read the above WordPress: Can’t log in to the WP-admin site. I am experiencing the same problem and I have to admit to being a rank outsider to code. A friend of mine set up the site and I was doing well until I started getting the message below.

Fatal error: Call to undefined function wp_add_dashboard_widget() in /home/vuvuzela/public_html/wp-content/plugins/google-analytics-for-wordpress/yst_plugin_tools.php on line 222

I am learning from your comments and have tried clearing the WP cookies but without a change. Must I clear all the cookies ?
My site works fine and is about making real African music with the dreaded Vuvuzelas for the 2010 World Cup so it is a matter of urgency that I service it.
Can anyone suggest what to do ?

12 02 2010 06.01AM

Pedro, try deleting the Google Analytics plugin, upgrade to the latest version of WordPress then reinstall the plugin. Hopefully that will solve the problem.

12 02 2010 10.31AM


I have just experienced the same problem as described above, but I know exactly what I did to cause it.

I did not follow the installation instructions as described for the Event Calendar Plug-in. I installed the plug-in then activated the widget prior to creating my first event. The hosed the wp-admin log-in.

Please follow the instructions exactly as followed. It worked beautifully on the test system.

I am going to re-install wp and rebuild my site.

If anyone has a solution it would be helpful.

17 05 2010 03.46AM

What should I do? I did put that code into my wp-config.php, but the same problem?!! What should I do please help… Thanks

15 06 2011 05.01AM

hi can anyone help?
i’m having trouble when log in to wp admin. the case is:
when i enter the correct username and password, it just clears the password text box. when i enter the correct username but wrong password, it shows the message error: Invalid username. Lost your password?
all the time i need to reset password (because i use my email as admin), so i wanna get out of this trouble. please reply if you have answer.

02 09 2011 12.10PM

I know I’m a coupe of years behind the other posts re WordPress: Can’t log in to the WP-admin site but I am having the same problem. I followed the advice re adding code in the wp-config.php file but now when I try to log in to the WP_admin site it takes me to http://my domain.com/wp-admin/install.php and asks me to instal WordPress which I’ve already done. HELP!!! PLEASE!!! I’m a total newbie to WordPress and FileZilla and would appreciate some clear advice. Thank you.

25 06 2012 10.03AM

Brilliant! Normally I can spend a week or so scratching around for a solution to a WP problem, but this was easy to find and worked instantly. Thanks!

11 02 2014 05.45PM

Wow.. its work for me. No need uninstall cache plugin, only add the “golden” php in config

05 09 2016 07.57PM

It work for me! Thank you very much!

13 03 2017 06.08AM
Daniel S.

Thanks so much, you really save me alot of timee./ It works!

13 09 2017 09.15PM

Leave a Comment

Your email address will not be published. Required fields are marked *

Let's start a project