php WordPress - 密码保护页面 - 强制密码输入

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php WordPress - 密码保护页面 - 强制密码输入相关的知识,希望对你有一定的参考价值。

//------------------------------------------------------------
//  Password Protected Pages - Force Immediate Cookie Expiry
//------------------------------------------------------------

add_action( 'wp', 'post_pw_sess_expire' );
    function post_pw_sess_expire() {
    if ( isset( $_COOKIE['wp-postpass_' . COOKIEHASH] ) )
    // Setting a time of 0 in setcookie() forces the cookie to expire with the session
    setcookie('wp-postpass_' . COOKIEHASH, '', 0, COOKIEPATH);
}

以上是关于php WordPress - 密码保护页面 - 强制密码输入的主要内容,如果未能解决你的问题,请参考以下文章