dimanche 20 mars 2016

get_current_user_id() returning Zero 0

get_current_user_id() is returning 0 for following codes. I do tried some solution available on stack overflow but somehow not working for me. I'm expecting explanation why its returning zero and how to fix?

P.S: I'm calling get_current_user_id() from external php page and included '../wp-blog-header.php' for that.

Code:

<?php
require('../wp-blog-header.php');
get_header();

$user_ID = get_current_user_id(); 
echo $user_ID;

?> 



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire