クッキーの生成コード

pluggable.php

<?php
function wp_generate_auth_cookie($user_id, $expiration, $scheme = 'auth') {
	$user = get_userdata($user_id);

	$pass_frag = substr($user->user_pass, 8, 4);

	$key = wp_hash($user->user_login . $pass_frag . '|' . $expiration, $scheme);
	$hash = hash_hmac('md5', $user->user_login . '|' . $expiration, $key);

	$cookie = $user->user_login . '|' . $expiration . '|' . $hash;

	return apply_filters('auth_cookie', $cookie, $user_id, $expiration, $scheme);
}
?>