[wp-hackers] Password protected post - how to require password everytime

Pavel Hejn pavelevap at post.cz
Sat Nov 13 17:12:54 UTC 2010


Thank you very much!

Simply clever...

Pavel

> ------------ Původní zpráva ------------
> Od: Andrew Nacin <wp at andrewnacin.com>
> Předmět: Re: [wp-hackers] Password protected post - how to require password
> everytime
> Datum: 12.11.2010 13:36:56
> ----------------------------------------
> On Fri, Nov 12, 2010 at 7:05 AM, Pavel Hejn <pavelevap at post.cz> wrote:
> 
> > Hello,
> >
> > when using password protected post and user inserts right password, then it
> > is probably saved in cookies, because when displaying this post again, no
> > password is required. But it is problem for some users (for public
> > computers, etc.).
> > I did not find any hook to change this behaviour and require password
> > everytime.
> > Is there any chance to do it as a small plugin?
> >
> 
> This works for me:
> 
> add_action( 'wp', 'post_password_immediately_expires' );
> function post_password_immediately_expires() {
>     if ( isset( $_COOKIE['wp-postpass_' . COOKIEHASH] ) )
>         setcookie('wp-postpass_' . COOKIEHASH, '', time() - 31536000,
> COOKIEPATH);
> }
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
> 
> 
> 


More information about the wp-hackers mailing list