A WordPress-centric search engine for devs and theme authors



set_current_user ›

Since2.0.1
Deprecated3.0.0
set_current_user ( $id, $name = '' )
Parameters: (2)
  • (int|null) $id User ID.
    Required: Yes
  • (string) $name Optional. The user's username
    Required: No
    Default: (empty)
See:
Returns:
  • (WP_User) returns wp_set_current_user()
Defined at:
Codex:

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.



Source

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