Sometimes my plugin causes the following error to be thrown, usually on activation but I’ve had it occur at other times:
Fatal error: Call to undefined function wp_get_current_user() in /path to wordpress install/wp-includes/capabilities.php on line 1059
There seems to be no logic behind it happening.
All I can assume is that one of my “current_user_can” checks is firing when it shouldn’t do but of course its very hard to find out which one.
The “fix” seems to be to add require_once(‘pluggable.php’); to the top of the capabilities.php file But I really shouldn’t have to ask users to do that.
- The topic ‘Random "Call to undefined function wp_get_current_user()" errors’ is closed to new replies.