How to change PHPSESSID cookie domain name in Wordpress?
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.