Make a new folder in your plugins directory called ‘post-password-expire-with-session’
within this create a file called ‘post-password-expire-with-session.php’ and copy in the following code:
<?php
/*
Plugin Name: Post Password Expire with session
Description: Forces password protected posts to prompt for a password each time they are accessed
Version: 1.0.0
License: GPL2
*/
function post_pw_expire_with_session() {
// Set a time of 0 in setcookie() to force the cookie to expire with the session
if ( isset( $_COOKIE['wp-postpass_' . COOKIEHASH] ) )
setcookie('wp-postpass_' . COOKIEHASH, '', 0, COOKIEPATH);
}
add_action( 'wp', 'post_pw_expire_with_session' );
After activating this ‘Post Password Expire with session’ plugin visitors should need to enter the password every time they visit the page.
Thank you! That worked perfectly!
That solution is too cool! Thanks, that was exactly what I was looking for as well.
Hi;
I have 5 costumers and i will make 5 different password protected pages for them. Sometimes i will send them passwords to see their pages. But when they are logged out, they can’t be logged in again.
How can it be possible?
Thanks in advance, my best regards;
Ahmet