Support » Fixing WordPress » Issue with cookies in wp-login

  • After I’ve switched the /wp-login.php or /wp-admin standard login URL to a different alternative (lets say /wploginaccess) eveytime I try to login it fails only once when trying to login every time with the following message:

    Cookies are blocked or not supported by your browser. You must enable cookies to use WordPress

    If I login twice, it goes well. It just fails the first time I try to login.

    This happens me in the 100% of my sites using Webarx for switching the login URL. I remember this was solved by introducing something in wp-config.php that I can barely remember (like the login url with a global variable or something like that)

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator bcworkz

    (@bcworkz)

    Sorry for the slow reply. It may be you are actually logged in despite the message. I intermittently get that message. When I then go directly to mydomain.com/wp-admin/ the dashboard loads without any issue. I think there’s something like a race condition happening, but I cannot reliably reproduce the problem to investigate further.

    Since your issue is not intermittent, it’s probably a different problem, but if in your case you are also actually logged in despite the message, it might be a useful clue. Since this is related to Webarx login switching, their dedicated support channel might be a better place to get help in resolving this.

    The sort of things commonly added to wp-config.php is all captured on https://wordpress.org/support/article/editing-wp-config-php/. While there are a number of cookie related edits there, they probably aren’t what you’re hoping for.

    Thread Starter SirLouen

    (@sirlouen)

    @bcworkz thanks for you answer

    Any ideas on how can I debug this issue?

    I’ve contacted webarx, but since it seems to be a random issue and found that it’s not actually happening on every other webarx installed site I have I would like to see if I can debug it by myself.

    Not sure which variables wordpress test for this error

    Moderator bcworkz

    (@bcworkz)

    There’s not much to debug. When wp-login.php loads, it sets a test cookie (around line 535). When the login credentials are submitted, wp-login.php looks for this test cookie and throws that error when it is not seen (around line 1261). The problem is either the initial setcookie() call didn’t work or the browser didn’t send it with the login request like it is supposed to.

    Have you found that you’re logged in despite that message? If so, setcookie() obviously is working at least part time, but the test cookie was not sent by the browser as expected. I’ve no idea how to debug issues with browsers.

    Have you tried different browsers? The issue might be related to a specific browser. In any case, you need to be able to reliably induce the error to be able to debug the issue.

    Thread Starter SirLouen

    (@sirlouen)

    Ok, so there is the issue, the test cookie doesn’t appear at first. Something is inhibiting the cookie or is not being set for some reason. That is what I need to debug, where has gone the cookie?

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.