You’ll also have to fill the variable, e.g.
function userinfo_global() {
global $users_info;
$users_info = wp_get_current_user();
}
add_action( 'init', 'userinfo_global' );
And you should then be able to use $users_info everywhere in global context. Keep in mind that some template pars (header.php, footer.php, those used via get_template_part
) are not in global scope by default, so you’ll have to use global $users_info;
in those files before accessing the variable.