• Hello I think this is the right forum
    I would like to integrate my WP login system with my other PHP project.
    My WP is installed om example.com and my other project is on a sub-domain eg. sub1.example.com.
    I found this code:

    require('../web/wp-blog-header.php');
    
    if ( is_user_logged_in() ) {
    echo 'Welcome, registered user!'.$user_email;
    } else {
    echo 'no';
    };

    This works and gives me the mail of the logged in user. I put the script on the main domain example.com/wp.php

    But my PHP project is on the sub-domain and if i move the script to the sub-domain it stops working. If I access the PHP site and every page where I include the ../web/wp-blog-header.php file it will redirect me to my main site at example.com. ??
    I also tried to fix this and added:

    define('COOKIEPATH', '/');
    define('COOKIE_DOMAIN', '.example.com');

    ut this din’t do any thing.

    How can I get the relult I want? or is there any plugin or other method?
    plz help!

  • The topic ‘Use WP login cookie for my PHP site’ is closed to new replies.