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()
Apparently this is happening because the file /wp-includes/pluggable
which contains the function doesn't get loaded until after the plugins are loaded.
Anybody any ideas on how to get the user details in my plugin?
try adding also
along with
As crazy as this might sound, the problem in my application was happening because I had a FILE called menu.php where I had a class to create Wordpress menus.
Literally, simply changing the name of the FILE from menu.php to nav-menu.php, fixed the issue. I replicated the issue 3 times because I could not believe the name of the FILE could be the problem.
Just in case somebody would like to now what was inside that file, here it is:
my issue solved with this code please
You can use this,
this should fix your problem :)
After the installation of wp 3.8 I had the same problem with a page I get with ajax. I fixed it with the following code:
Apparently the function is moved from pluggable.php to user.php. Still I don't understand why it doesn't work after I included the wp-blog-header.php.
NOT
wp-includes
but :