Support » Plugins » Hacks » PW Protected page don't ask for PW when…

  • Hi,

    I have added this code:

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

    into my functions.php and i t works fine when I click another page and then click the protected page again but if I use the back arrow in my browser it does not ask for the password again.

    Can this be achived in any way?


Viewing 1 replies (of 1 total)
  • Hi Kolsyra,

    This is a browser limitation. When you navigate backwards via browser history (e.g. clicking the back button), the browser remembers the state of the page when you left it rather than querying the server for the page again.

    Fixing this issue would likely require more theme customization via javascript to recognize that the visit is coming from a backwards navigation and then some more php and javascript customization to refresh the page or something else like that.

Viewing 1 replies (of 1 total)
  • The topic ‘PW Protected page don't ask for PW when…’ is closed to new replies.