Can I simulate a user being logged in from a WP_UnitTestCase? April 10, 2022 by Tarik Billa Call wp_set_current_user($id) to make a user ID the currently logged in user.