get_current_user_id() returns 0
-
I have an installation of WordPress que I use for the blog and in the directory, I have an application developed in PHP. To avoid redundancy I use the login of web to get access to this app, so people registered in WP, can see the content Within this app.
Before the last update to 4.2 WP, it used to work perfectly but now it does not.
In the header of my PHP I used the following code to get the user_id:
require_once(‘../../wp-blog-header.php’);
$userID = get_current_user_id();
print_r($userID);
if ( $userID<=0 ) {
//header(‘location: /login/’);exit(0);
}It doesn’t work, the user_id = 0.
I think something changed the way WP manage the sessions or something like that.
Does anyone know how can i solve this?
Thanks in advance.
- The topic ‘get_current_user_id() returns 0’ is closed to new replies.