I\'m trying to get the current user info in my plugin using the func wp_get_current_user(). But am getting
Call to undefined function wp_get_current_user()
I got the same error message after updating WP. The fix that worked for me is quick and easy:
Locate capabilities.php in the wp-includes directory (WP 3.8.x). Add the following at the top, after the opening php tag:
require_once('pluggable.php');
wp-includes
but :include_once(ABSPATH . "wp-admin/includes/plugin.php");
You can use this,
<?php
if(!function_exists('wp_get_current_user')) {
include(ABSPATH . "wp-includes/pluggable.php");
}
?>
this should fix your problem :)