Title: PHP Fatal error: Uncaught Error: Call to undefined function wp_get_current_user(
Last modified: March 26, 2018

---

# PHP Fatal error: Uncaught Error: Call to undefined function wp_get_current_user(

 *  [clockwood](https://wordpress.org/support/users/clockwood/)
 * (@clockwood)
 * [8 years, 2 months ago](https://wordpress.org/support/topic/php-fatal-error-uncaught-error-call-to-undefined-function-wp_get_current_user/)
 * I’m getting the following error when enabling this plugin:
 * `AH01071: Got error 'PHP message: PHP Fatal error: Uncaught Error: Call to undefined
   function wp_get_current_user() in /var/www/vhosts/domain.com/httpdocs/wp-includes/
   capabilities.php:590\nStack trace:\n#0 /var/www/vhosts/domain.com/httpdocs/wp-
   content/plugins/hwp-utility-plugin/hwp-utility.php(121): current_user_can('administrator')\
   n#1 /var/www/vhosts/domain.com/httpdocs/wp-includes/class-wp-hook.php(286): hwp_pre_user_query(
   Object(WP_User_Query))\n#2 /var/www/vhosts/domain.com/httpdocs/wp-includes/class-
   wp-hook.php(310): WP_Hook->apply_filters('', Array)\n#3 /var/www/vhosts/domain.
   com/httpdocs/wp-includes/plugin.php(515): WP_Hook->do_action(Array)\n#4 /var/
   www/vhosts/domain.com/httpdocs/wp-includes/class-wp-user-query.php(576): do_action_ref_array('
   pre_user_query', Array)\n#5 /var/www/vhosts/domain.com/httpdocs/wp-includes/class-
   wp-user-query.php(77): WP_User_Query->prepare_query(Array)\n#6 /var/www/vhosts/
   domain.com/httpdocs/wp-includes/user.php(561): WP_User_Query->__construct(Arr...\
   n'`
 * Here is the relevant plugin code that uses ‘current_user_can’ – causes a white
   screen when WPFC is enabled and user is logged out:
 *     ```
       /**
         * Hide Administrator from User list
         */
       add_action( 'pre_user_query', 'hwp_pre_user_query' );
       function hwp_pre_user_query( $user_search ) {
           if ( !current_user_can( 'administrator' ) ) { // Is Not Administrator - Remove Administrator
               global $wpdb;
   
               $user_search->query_where = str_replace(
                   'WHERE 1=1', 
                   "WHERE 1=1 AND {$wpdb->users}.ID IN (
                     SELECT {$wpdb->usermeta}.user_id FROM $wpdb->usermeta 
                     WHERE {$wpdb->usermeta}.meta_key = '{$wpdb->prefix}capabilities'
                     AND {$wpdb->usermeta}.meta_value NOT LIKE '%administrator%' )", 
                   $user_search->query_where
               );
           }
       }
       ```
   

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

 *  Plugin Author [Emre Vona](https://wordpress.org/support/users/emrevona/)
 * (@emrevona)
 * [8 years, 2 months ago](https://wordpress.org/support/topic/php-fatal-error-uncaught-error-call-to-undefined-function-wp_get_current_user/#post-10120444)
 * are you sure that the problem is caused by WP Fastest Cache? because I did not
   see any word about wp fastest cache.
 *  Thread Starter [clockwood](https://wordpress.org/support/users/clockwood/)
 * (@clockwood)
 * [8 years, 2 months ago](https://wordpress.org/support/topic/php-fatal-error-uncaught-error-call-to-undefined-function-wp_get_current_user/#post-10121202)
 * I’m not sure actually, but the only time the error occurs is when I enable caching
   with WPFC and am logged out. I was curious if you’ve seen this before.
 *  Plugin Author [Emre Vona](https://wordpress.org/support/users/emrevona/)
 * (@emrevona)
 * [8 years, 2 months ago](https://wordpress.org/support/topic/php-fatal-error-uncaught-error-call-to-undefined-function-wp_get_current_user/#post-10121749)
 * Actually I did not get such ticket before.
 *  Thread Starter [clockwood](https://wordpress.org/support/users/clockwood/)
 * (@clockwood)
 * [8 years, 2 months ago](https://wordpress.org/support/topic/php-fatal-error-uncaught-error-call-to-undefined-function-wp_get_current_user/#post-10132834)
 * interesting. I got the error again when I reinstalled – here’s a screenshot of
   the error, this one mentions WPFC: [https://imgur.com/a/y86jn](https://imgur.com/a/y86jn)

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

The topic ‘PHP Fatal error: Uncaught Error: Call to undefined function wp_get_current_user(’
is closed to new replies.

 * ![](https://ps.w.org/wp-fastest-cache/assets/icon-256x256.png?rev=2064586)
 * [WP Fastest Cache - WordPress Cache Plugin](https://wordpress.org/plugins/wp-fastest-cache/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-fastest-cache/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-fastest-cache/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-fastest-cache/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-fastest-cache/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-fastest-cache/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [clockwood](https://wordpress.org/support/users/clockwood/)
 * Last activity: [8 years, 2 months ago](https://wordpress.org/support/topic/php-fatal-error-uncaught-error-call-to-undefined-function-wp_get_current_user/#post-10132834)
 * Status: not resolved