Can I simulate a user being logged in from a WP_UnitTestCase?

Call wp_set_current_user($id) to make a user ID the currently logged in user.

Leave a Comment