W3cubDocs

/WordPress

wp_setcookie( string $username, string $password = '', bool $already_md5 = false, string $home = '', string $siteurl = '', bool $remember = false )

This function has been deprecated. Use wp_set_auth_cookie() instead.

Sets a cookie for a user who just logged in. This function is deprecated.

Description

See also

Parameters

$username

(string) (Required) The user's username

$password

(string) (Optional) The user's password

Default value: ''

$already_md5

(bool) (Optional) Whether the password has already been through MD5

Default value: false

$home

(string) (Optional) Will be used instead of COOKIEPATH if set

Default value: ''

$siteurl

(string) (Optional) Will be used instead of SITECOOKIEPATH if set

Default value: ''

$remember

(bool) (Optional) Remember that the user is logged in

Default value: false

Source

File: wp-includes/pluggable-deprecated.php

function wp_setcookie($username, $password = '', $already_md5 = false, $home = '', $siteurl = '', $remember = false) {
	_deprecated_function( __FUNCTION__, '2.5.0', 'wp_set_auth_cookie()' );
	$user = get_user_by('login', $username);
	wp_set_auth_cookie($user->ID, $remember);
}

Changelog

Version Description
2.5.0 Use wp_set_auth_cookie()
1.5.0 Introduced.

© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/wp_setcookie