Solution:
Try to add below code in your theme’s function.php
//fix for cookie error while login.
setcookie(TEST_COOKIE, 'WP Cookie check', 0, COOKIEPATH, COOKIE_DOMAIN);
if ( SITECOOKIEPATH != COOKIEPATH )
setcookie(TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN);
One more option which worked for me, I developed my client’s on my server and it’s URL is “www.mydomain/clients/clientname” when i deployed it to client’s server on main domain i was getting this cookie issue in WordPress backend, tried almost every solution available online but this one worked for me. Go to wordpress database and check “wp_options” option table and change url to you domain URL Woila! worked for me.
See if this can help someone.