Title: Call to undefined function wp_get_current_user()
Last modified: August 21, 2016

---

# Call to undefined function wp_get_current_user()

 *  Resolved [Eddie](https://wordpress.org/support/users/eddie6671/)
 * (@eddie6671)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/call-to-undefined-function-wp_get_current_user-2/)
 * After updating to the latest BPS, on a multisite WP installation v. 3.5.1, admin
   pages immediately became unavailable, due to the following error:
 * PHP Fatal error: Call to undefined function wp_get_current_user() in /home/apache/
   wordpress/wp-includes/capabilities.php on line 1451
 * According to:
    [https://wordpress.org/support/topic/plugin-post-from-site-fatal-error-undefined-function](https://wordpress.org/support/topic/plugin-post-from-site-fatal-error-undefined-function)
 * when this happens it is because wp-includes/pluggable.php contains this function,
   but this file is not getting loaded until after the plugins are loaded.
 * I was able to fix the problem by adding:
    require_once(ABSPATH . ‘wp-includes/
   pluggable.php’);
 * to /wp-content/plugins/bulletproof-security/bulletproof-security.php
 * as soon as I added that line admin pages became accessible again and the error
   is no longer triggered.
 * [http://wordpress.org/extend/plugins/bulletproof-security/](http://wordpress.org/extend/plugins/bulletproof-security/)

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Plugin Author [AITpro](https://wordpress.org/support/users/aitpro/)
 * (@aitpro)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/call-to-undefined-function-wp_get_current_user-2/#post-3669038)
 * Wierd. BPS does not use the wp_get_current_user() function. BPS does use the 
   WordPress current_user_can() function to check user capabilities.
 * Try commenting out the line you added below with 2 forward slashes and let me
   know if the error occurs again. It may have just been a coincidence or maybe 
   there is some other factor that is not obvious going on.
    // require_once(ABSPATH.‘
   wp-includes/pluggable.php’);
 *  Plugin Author [AITpro](https://wordpress.org/support/users/aitpro/)
 * (@aitpro)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/call-to-undefined-function-wp_get_current_user-2/#post-3669039)
 * Did you Network Activate BPS on your Network/Multisite installation? BPS should
   not be Network Activated and should only be activated on the Primary site for
   Network/Multisite.
 *  Plugin Author [AITpro](https://wordpress.org/support/users/aitpro/)
 * (@aitpro)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/call-to-undefined-function-wp_get_current_user-2/#post-3669081)
 * Oops yeah wp_get_current_user() is in capabilities and not BPS. Spaced out for
   a sec. LOL. Apparently this is some odd random occurrence that happens only on
   Mulitsite and I do not see that anyone has ever figured out what actually causes
   it. I will add this as it would not hurt anything, but I will need to research
   it fully before adding it. Thanks.
 *  Plugin Author [AITpro](https://wordpress.org/support/users/aitpro/)
 * (@aitpro)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/call-to-undefined-function-wp_get_current_user-2/#post-3669197)
 * This has been researched and tested and everything works perfectly. Thank you
   for pointing this out. Very much appreciated.
 *  Thread Starter [Eddie](https://wordpress.org/support/users/eddie6671/)
 * (@eddie6671)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/call-to-undefined-function-wp_get_current_user-2/#post-3669233)
 * It was my pleasure, and many thanks for being so responsive, and for your work
   on this excellent plugin 🙂
 * Look forward to the fix appearing soon, but if it doesn’t, no big deal, I have
   my ugly kludge patch. Here it is in case it helps any multisite people until 
   the real fix is merged:
 *     ```
       --- a/wp-content/plugins/bulletproof-security/bulletproof-security.php  2013-04-17 23:11:09.640004664 +0100
       +++ b/wp-content/plugins/bulletproof-security/bulletproof-security.php  2013-04-17 23:10:30.610004665 +0100
       @@ -46,6 +46,7 @@
   
        // If in WP Admin Dashboard
        if ( is_admin() ) {
       +    require_once(ABSPATH . 'wp-includes/pluggable.php');
            require_once( WP_PLUGIN_DIR . '/bulletproof-security/admin/includes/admin.php' );
               register_activation_hook(__FILE__, 'bulletproof_security_install');
               register_deactivation_hook(__FILE__, 'bulletproof_security_deactivation');
       ```
   
 *  Plugin Author [AITpro](https://wordpress.org/support/users/aitpro/)
 * (@aitpro)
 * [13 years ago](https://wordpress.org/support/topic/call-to-undefined-function-wp_get_current_user-2/#post-3669380)
 * adding just…
 * `require_once(ABSPATH . 'wp-includes/pluggable.php');`
 * …causes some problems for other plugins so this code will be changed to include
   this additional conditional check below…
 *     ```
       if ( is_admin() ) {
           require_once( WP_PLUGIN_DIR . '/bulletproof-security/admin/includes/admin.php' );
       	if ( wp_script_is( 'bps-js', $list = 'queue' ) ) {
       		require_once(ABSPATH . 'wp-includes/pluggable.php');
       	}
       ```
   
 * Please test this code on your site and let me know if it works. Thanks.
 *  Plugin Author [AITpro](https://wordpress.org/support/users/aitpro/)
 * (@aitpro)
 * [12 years, 12 months ago](https://wordpress.org/support/topic/call-to-undefined-function-wp_get_current_user-2/#post-3669400)
 * Wow dumb one. Went down the rabbit hole looking in the wrong place. This is the
   correct solution to the problem.
    [http://wordpress.org/support/topic/36-beta-issue?replies=3](http://wordpress.org/support/topic/36-beta-issue?replies=3)

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Call to undefined function wp_get_current_user()’ is closed to new replies.

 * ![](https://ps.w.org/bulletproof-security/assets/icon-128x128.png?rev=1731938)
 * [BulletProof Security](https://wordpress.org/plugins/bulletproof-security/)
 * [Support Threads](https://wordpress.org/support/plugin/bulletproof-security/)
 * [Active Topics](https://wordpress.org/support/plugin/bulletproof-security/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/bulletproof-security/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/bulletproof-security/reviews/)

 * 7 replies
 * 2 participants
 * Last reply from: [AITpro](https://wordpress.org/support/users/aitpro/)
 * Last activity: [12 years, 12 months ago](https://wordpress.org/support/topic/call-to-undefined-function-wp_get_current_user-2/#post-3669400)
 * Status: resolved