How do I modify each instance of setcookie?
-
I have an internal WordPress site that I’m trying to embed via iFrame. Currently, I’m stuck on:
Error: Cookies are blocked or not supported by your browser. You must enable cookies to use WordPress.
I have tried to add the following to my .htaccess:
<IfModule mod_headers.c> Header set Access-Control-Allow-Origin https://parent.com Header set X-Frame-Options ALLOWALL Header always edit Set-Cookie (.*) "$1;Secure;SameSite=none" </IfModule> <IfModule LiteSpeed> ForceSecureCookie secure same_site_none </IfModule>
However, the cookies still appear without SameSite=None:
When I set a custom cookie:
function add_cookie( ) { $cookie_options = array( 'expires' => time() + 3600, 'path' => '/', 'domain' => 'xxx.com', // leading dot for compatibility 'secure' => true, // only transmit over HTTPS 'httponly' => true, // make cookie accessible through HTTP protocol only 'samesite' => 'None' // None || Lax || Strict ); $set_cookie = setcookie( 'wp-test-cookie', 'samesite', $cookie_options ); } add_action( "login_init", "add_cookie" );
It sets it correctly:
Any suggestions?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘How do I modify each instance of setcookie?’ is closed to new replies.