Support » Plugin: WP Approve User » Empty Current User ( pre_user_query )

  • Resolved Howdy_McGee

    (@howdy_mcgee)


    In a custom plugin I’m using pre_user_query to check if the current user role and modify the query appropriately. Whenever WP Approve User plugin is enabled the global $current_user is empty and wp_get_current_user() errors out because there is no current user. This all happens in the pre_user_query hook which runs on wp-admin/users.php.

    If I disable the plugin and print global $current_user I get a WP_User as expected. Somewhere in this plugin the user is being removed.

    add_action( 'pre_user_query', function( $query ) {
    
    	global $current_user;
    
    	printf( '<pre>%1$s</pre>', print_r( $current_user, 1 ) );
    	die();
    
    } );
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.