wp_signon returns user but the user is not logged in because wp installed on subdomain. How to make it work?

I solved the problem. Here’s the solution.

Add this line to your wp-config.php :

define('COOKIE_DOMAIN', '.yourdomain.com');

save the file and upload. That’s all.