the pandemic has changed my role within my company so that I'm now doing all of our WordPress development, despite having zero training with WordPress. Feel free to include any comments about my boss' lack of wisdom if you like!
Anyway, what I'm trying to accomplish is to create a page that is password-protected. A visitor that knows the password can enter it and view the content. So far, so good. I figured that out and was even able to customize the look of the login screen so it isn't as ugly as the default.
The client, however, asked that I configure the page so that if a visitor leaves the page, they are required to re-enter the password to get back to the content. There seem to be a fair number of possible solutions, but I can't seem to make any of them work. The code that I seem to keep finding is some variation of this:
function wpse_191369_post_password_expires() {
return time() + 10; // Expire in 10 seconds
}
add_filter( 'post_password_expires', 'wpse_191369_post_password_expires' );
I've plugged this into my child theme's functions.php, and tested in incognito mode on Chrome. I can sign in once and view the content but if I try opening up a new incognito tab or window, I can still access the content without entering the password.
I'm sure the solution is painfully obvious, but I'm a novice here and am really just stumbling around in the dark!
Thanks in advance for any the advice!