0

I have a problem which appeared lately on my Wordpress front page connection on Chrome only (Chrome / WordPress update ?).

When a user logs in, he is redirected on the front page of my website but the user session cookie is not set.

If he just reloads the page, the cookie will be set. It feels like the cookie was not setting fast enough for the browser's redirection. The weird part is as I said earlier the problem only occurs on Chrome.

My Wordpress version is 4.1.7

My Chrome version is 43.0.2357.134

Any ideas ? Thank you.

Axel

Noman
  • 4,088
  • 1
  • 21
  • 36

1 Answers1

0

I had the same problem with setcookie() without using add_action to wp_head and finally found the solution.

add_action('wp_head', 'my_setcookie');
function my_setcookie()
{
    if (!empty($_REQUEST['currency'])) {

        $currency_request = esc_attr($_REQUEST['currency']);
        setcookie('currency_cookie', $currency_request, time() + 3600, COOKIEPATH);
    }

}
Noman
  • 4,088
  • 1
  • 21
  • 36
  • Thank you for your answer, but it is not exactly the same problem. I don't want to set manually any cookie, it is a cookie set by Wordpress core login functionnality. – user3328959 Aug 06 '15 at 12:16
  • please check this thread http://stackoverflow.com/questions/5849013/setcookie-does-not-set-cookie-in-google-chrome – Noman Aug 06 '15 at 12:43
  • This is not on my localhost but in the live version I saw the problem :/ I could actually try a workaround like reloading the page once when I detect the users tries to connect but I would prefer a "clean" code and also understanding the origin of the problem.. Anyway thank you again but it seems like it is not the answer I am looking for. – user3328959 Aug 06 '15 at 13:02