Uses
| Uses | Description |
|---|---|
| wp-includes/pluggable.php: wp_set_current_user() | Changes the current user by ID or name. |
| wp-includes/user.php: username_exists() | Determines whether the given username exists. |
(int) (Required)
(int|void)
File: wp-admin/includes/class-wp-importer.php
public function set_user( $user_id ) {
if ( is_numeric( $user_id ) ) {
$user_id = (int) $user_id;
} else {
$user_id = (int) username_exists( $user_id );
}
if ( ! $user_id || ! wp_set_current_user( $user_id ) ) {
fwrite( STDERR, "Error: can not find user\n" );
exit;
}
return $user_id;
}
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_importer/set_user