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.

Return

WP_User. returns wp_set_current_user()

Usage

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

Notes

  • See: wp_set_current_user()

Changelog

Since 2.0.1 Introduced.
Deprecated Since 3.0.0 Use wp_set_current_user()

Code of set_current_user() WP 5.5.1

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