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.
$idint|nullrequired
$namestringoptional
Default:''
function set_current_user($id, $name = '') {
_deprecated_function( __FUNCTION__, '3.0.0', 'wp_set_current_user()' );
return wp_set_current_user($id, $name);
}
| Version | Description |
|---|---|
| 3.0.0 | Use wp_set_current_user() |
| 2.0.1 | Introduced. |
© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/set_current_user