• Hi everyone, I am a newbie programmer and I really need help.

    I have a wordpress site, and I want in a .php page of my own to display the info of the logged in user.
    I tried this:

    <?php
     global $current_user;
     get_currentuserinfo();
     echo $current_user->user_login;
     ?>

    but I get a constant error “Call to undefined function get_currentuserinfo()”. I included the “pluggable.php” file which contains the function but it didn’t work.
    Somewhere I came across this which might be the solution:
    `Apparently this is happening because the file /wp-includes/pluggable which contains the function doesn’t get loaded until after the plugins are loaded. Indeed it is. So wrap whichever thing you’re doing in a function, and hook it onto the plugins_loaded or init hook. (see the wp-settings.php file)

    What exactly do I have to write and in which file?

  • The topic ‘Call to undefined function get_currentuserinfo()’ is closed to new replies.