set_current_user


set_current_user ( $id, $name = '' )

Parameters:
  • (int|null) $id User ID.
  • (string) $name Optional. The user's username
See:
Returns:
  • (WP_User) returns wp_set_current_user()
Defined at:

Description

Changes the current user by ID or name.

Set $id to null and specify a name if you do not know a user's ID.

Related Functions

wp_set_current_user, wp_get_current_user, get_current_user_id, _wp_get_current_user, set_current_screen

Top Google Results

User discussions

wpseek mobile