dimanche 14 février 2016

Can't get user roll in custom WordPress page

I have a file in my child theme that i use to print some data.

It works and returns the data with WP functions.

The problem is that i can access user rolls, instead I get 0.

I think i need call get_current_user_id() while hooking into some wp function, but can't figure out how.

How could i get get user info in a file like this?

<?php
$parse_uri = explode( 'wp-content', $_SERVER['SCRIPT_FILENAME'] );
require_once( $parse_uri[0] . 'wp-load.php' );
echo get_current_user_id(); // Doesn't work - I get 0 
// Printing some stuff - works ok, i get info with WP functions



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire