set_current_user

Advertisement

Deprecated Deprecated

This function has been deprecated. Use wp_set_current_user() instead.

Summery Summery

Changes the current user by ID or name.

Syntax Syntax

set_current_user( int|null $id, string $name = '' )

Description Description

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

Parameters Parameters

$id

(Required) User ID.

$name

(Optional) The user's username

Default value: ''

Return Return

(WP_User) returns wp_set_current_user()

Source Source

File: wp-includes/pluggable-deprecated.php

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

Advertisement

Changelog Changelog

Changelog
Version Description
3.0.0 Use wp_set_current_user()
2.0.1 Introduced.

See also See also

Advertisement

Leave a Reply