using the_author_meta in a global variable
-
I have defined an additional field ‘client’ for user profiles.
I am calling this value in a page using <?php set_client(); ?>
In the functions.php I have the following function
//first a global variable is set to which I am assigning the client value
$client = the_author_meta(‘client’);function set_client(){
global $client;
echo $client;
}The above function echos empty. It doesn’t return the required value
If I use the same function without using global variable, it works fine, as shown below:
function set_client(){
$client = the_author_meta(‘client’);
echo $client;
}This works fine.
For my program, it is important to set the value in a global variable as I am going to be using it in multiple places in my page. Can someone please tell me what exactly I am doing wrong.
Please help.
- The topic ‘using the_author_meta in a global variable’ is closed to new replies.