WordPress at a glance
function is not described

set_current_user() WP 2.0.1

Deprecated in from version 3.0.0. It is no longer supported and can be removed in future releases. Use wp_set_current_user() instead.

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.

No Hooks.


WP_User. returns wp_set_current_user()


set_current_user( $id, $name );
$id(int/null) (required)
User ID.
The user's username
Default: ''


  • See: wp_set_current_user()


Since 2.0.1 Introduced.
Deprecated Since 3.0.0 Use wp_set_current_user()

Code of set_current_user() WP 5.5.1

function set_current_user($id, $name = '') {
	_deprecated_function( __FUNCTION__, '3.0.0', 'wp_set_current_user()' );
	return wp_set_current_user($id, $name);