Empty Current User ( pre_user_query )
-
In a custom plugin I’m using
pre_user_queryto check if the current user role and modify the query appropriately. Whenever WP Approve User plugin is enabled theglobal $current_useris empty andwp_get_current_user()errors out because there is no current user. This all happens in thepre_user_queryhook which runs onwp-admin/users.php.If I disable the plugin and print
global $current_userI 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)
The topic ‘Empty Current User ( pre_user_query )’ is closed to new replies.