I’m getting this warning on the browser console for my Wordpress site.
A cookie associated with a cross-site resource at https://www.google.com/ was set without the
SameSiteattribute. A future release of Chrome will only deliver cookies with cross-site requests if they are set with
Secure. You can review cookies in developer tools under Application>Storage>Cookies and see more details at chromestatus.com/feature/5088147346030592 and chromestatus.com/feature/5633521622188032.
I tried to fix the problem by adding the following codes to the child theme functions.php file, but nothing happened. I believe I am missing something, maybe an code opening or something else since I am not a PHP expert.
setcookie(‘same-site-cookie’, ‘foo’, [‘samesite’ => ‘Lax’]);
setcookie(‘cross-site-cookie’, ‘bar’, [‘samesite’ => ‘None’, ‘secure’ => true]);
Please note that I am running PHP 7.4.
Can you please help my fix this warning.