WPDev.one
Core Function
View Source on Trac ↗

set_current_user()

set_current_user( mixed $id, mixed $name = '' )

Changes the current user by ID or name.

Parameters 1 required

Name / Type Description
(int

| null) $id User ID.

Required
$name
string

Optional. The user's username

Return Value

(WP_User)
returns wp_set_current_user()

Function Information

Since Version
2.0.1
Source File
wp-includes/pluggable-deprecated.php
Advertisement