WordPress at a glance
function is not described

wp_setcookie() WP 1.5.0

Deprecated from version 2.5.0. It is no longer supported and can be removed in future releases. Use wp_set_auth_cookie() instead.

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

No Hooks.


null. Nothing.


wp_setcookie( $username, $password, $already_md5, $home, $siteurl, $remember );
$username(string) (required)
The user's username
The user's password
Whether the password has already been through MD5
Will be used instead of COOKIEPATH if set
Will be used instead of SITECOOKIEPATH if set
Remember that the user is logged in


  • See: wp_set_auth_cookie()


Since 1.5.0 Introduced.
Deprecated Since 2.5.0 Use wp_set_auth_cookie()

Code of wp_setcookie() WP 5.7.2

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