6

I have some logic in my code that's based on whether or not the user is logged in. How do I test it from my WP_UnitTestCase?

11

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.