set_current_user()
Deprecated since 3.0.0. It is no longer supported and may 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.
Returns
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 7.0
function set_current_user($id, $name = '') {
_deprecated_function( __FUNCTION__, '3.0.0', 'wp_set_current_user()' );
return wp_set_current_user($id, $name);
}