I just upgraded to WordPress 3.1.1 and suddenly I’m getting the following error:
Fatal error: Call to undefined function wp_get_current_user() in /home/arisehub/arisehub.org/wp-includes/capabilities.php on line 1028
I’ve narrowed it down to my usage of “current_user_can”
Example:
if ( !current_user_can('manage_options') ) { add_action('admin_init','customize_page_meta_boxes'); }
Removing that reference to current_user_can removes the errors. Any ideas?
You are calling the function too early. The
functions.php
is included beforecurrent_user_can()
is defined. Never do anything before the hook'after_setup_theme'
:Example for the functions.php