post密码cookie设置为:
setcookie(
\'wp-postpass_\' . COOKIEHASH,
$hasher->HashPassword( wp_unslash( $_POST[\'post_password\'] ) ),
$expire,
COOKIEPATH,
COOKIE_DOMAIN,
$secure
);
在
wp-login.php
文件
然后我们可以使用clear_auth_cookie
挂钩,在wp_clear_auth_cookie()
函数,以便在注销时将其清除:
/**
* Clear the Post Password Cookie on logout.
*
* @link http://wordpress.stackexchange.com/a/198890/26350
*/
add_action( \'clear_auth_cookie\', function()
{
setcookie(
\'wp-postpass_\' . COOKIEHASH,
\'\',
time() - YEAR_IN_SECONDS,
COOKIEPATH,
COOKIE_DOMAIN
);
});