WordPress at Your Fingertips
function is not described

WP_Importer::set_user() public WP 1.0

{} It's a method of the class: WP_Importer{}

No Hooks.

Return

Int|null.

Usage

$WP_Importer = new WP_Importer();
$WP_Importer->set_user( $user_id );
$user_id(int) (required)
-

Code of WP_Importer::set_user() WP 5.8.2

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;
}