Codex tools: Log in
Contents |
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.
Some WordPress functionality is based on the current user and not based on the signed in user. wp_set_current_user() opens the ability to edit and perform actions on users who aren't signed in.
<?php wp_set_current_user( $id, $name ); ?>
Since: 2.0.4
wp_set_current_user() is located in wp-includes/pluggable.php.