I have a WordPress site which sets the PHPSESSID cookie with domain name www.example.com
.
I want it to set it to .example.com
so I can use it in the subdomain.
Set the domain calling session_set_cookie_params()
.
Read the docs here.
Basically do something like:
session_set_cookie_params ( 0, '/', 'example.com' );
If you are on PHP 7.3 you can do it like this:
session_set_cookie_params ( ['domain' => 'example.com'] );
Call this early in execution. Setting this on your wp-config.php
should be safe enough.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With