Tell me more ×
WordPress Answers is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Is there a way to password protect multiple pages with one password and also have that password expire after X hours? The user would be able to login to any page with the same password and then be given access to all other pages that use that same password with one added ability that the password expires after 3 hours of use.

Some code I've tried that accomplishes the time to live on the password is here:

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, '', 10800, COOKIEPATH);
}

Any help would be appreciated! Thank you!

share|improve this question

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.