set_current_user()
Deprecated 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
Changelog
Since 2.0.1 | Introduced. |
Deprecated since 3.0.0 | Use wp_set_current_user() |
set_current_user() set current user code WP 6.7.1
function set_current_user($id, $name = '') { _deprecated_function( __FUNCTION__, '3.0.0', 'wp_set_current_user()' ); return wp_set_current_user($id, $name); }