Call to Undefined Function get_currentuserinfo() Error in WordPress
In WordPress blog publishing system, there may be error been logged in Apache web server error_log file or been displayed on web pages which looks like the following line:
Fatal error: Call to undefined function: get_currentuserinfo() in /wordpress/wp-content/plugins/plugin.php
The undefined get_currentuserinfo function error normally happens in a poorly coded plugin. If the user deactivate the plug-in that causes the error, the issue will be fixed, resolved and go away. The error happens because $userdata or $user_id global variables become null, not defined or of empty value after the plugin is initiated, included, hooked and loaded.
The User ID and User Data (which User ID is part of) is globally-available var when in the WordPress admin pages. To resolve and fix the undefined get_currentuserinfo() function error, reset and scope the variable to global in the plugin before the beginning of the function which calling get_currenctuserinfo().
To set $userdata or $user_id vars to global scope, add in one of the following line into the beginning of the plugin PHP file:
$userdata = $GLOBALS['userdata'];
or,
global $userdata;
For user id, use “global $user_id;” instead.
Update: Above trick does not work in new WordPress version, try the fix undefined function get_currentuserinfo() fatal error guide instead.
Recent Articles
- Samsung Galaxy Note 8.0 With TouchWiz Android skin
- Samsung’s Giving Away a Million Copies of Jay-Z’s New Album “Magna Carta Holy Grail”
- 50-inch Ultra HD LED 4K TV For Only $966 Is Simply Bonkers
- AVG Anti-Virus 2013 Free Direct Download Link With 1-Year License Serial Key Code
- Samsung Galaxy Mega 6.3 Ready for Pre-Order In India






