I’m reposting this question because the problem wasn’t solved.
In a relevant question the answer below may 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)
Where exactly do I write the add_action(‘plugins_loaded’,’my_function’); command?
In the “wp-settings file”, the “pluggable” or my own php file?
All I want to do is to display the user info in a php file which is loaded in a page in wordpress,but I’m constantly getting the same error “call to undefined function”.
I’ve tried including the relevant php file, still doesn’t work.
<?php
global $current_user;
get_currentuserinfo();
echo $current_user->user_login;
?>
This might work for you!!
All you do is include the pluggable.php file in your plugin.