Wali Muhammad Khubaib
Wali Muhammad Khubaib

Reputation: 125

Using a different php script to get wp_loggedin value and then returning value in Android app

Hello I'm working on a website on WordPress alongside with it's Android app. Can we use a php script in which we can get the user login status (wp_loggedin) and return the value in the Android app?

Upvotes: 1

Views: 31

Answers (1)

Reza Saadati
Reza Saadati

Reputation: 5439

Try to see it as an Ajax call.

Create a PHP file in your theme.

example.php

if (is_user_logged_in() == true) {
    echo 'true';
}
else {
    echo 'false';
}

From your Android app just call the URL http://example.com/wp-content/YOUR-THEME/example.php

If the page gives you true, that means the user is logged in. If it returns false, the user is not logged in.

Upvotes: 1

Related Questions