Function Reference/set current user
This function has been deprecated. That means it has been replaced by a new function or is no longer supported, and may be removed from future versions. All code that uses this function should be converted to use its replacement if one exists. See also
Use any of these functions
This function can be replaced via plugins. If plugins do not redefine these functions, then this will be used 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.
<?php set_current_user( $id, $name ) ?>
- (integer|null) (required) User ID.
- Default: None
- (string) (optional) The user's username
- Default: ''
- returns values returned by wp_set_current_user()
- This function can be replaced via plugins. If plugins do not redefine these functions, then this will be used instead.
- Uses: wp_set_current_user()
set_current_user() is located in wp-includes/pluggable-deprecated.php.