Hi all,
I'm running a site on WP, and it won't let me access information from the global variable $current_user, after I run get_currentuserinfor().
I have a php file in my theme (not a wordpress-specific file), and in that file, have the following:
<?php
define('WP_USE_THEMES', false);
require('../../../wp-blog-header.php');
print_r ($current_user);
?>
Then, in wp-blog-header, I have the following:
<?php
/**
* Loads the WordPress environment and template.
*
* @package WordPress
*/
if ( !isset($wp_did_header) ) {
$wp_did_header = true;
require_once( dirname(__FILE__) . '/wp-load.php' );
wp();
require_once( ABSPATH . WPINC . '/template-loader.php' );
global $current_user;
get_currentuserinfo();
}
?>
When I try to access my php file in a browser, I get the following:
WP_User Object ( [data] => [ID] => 0 [id] => 0 [caps] => Array ( ) [cap_key] => [roles] => Array ( ) [allcaps] => Array ( ) [first_name] => [last_name] => [filter] => )
I would appreciate any help you all have!