Viewing 6 replies - 1 through 6 (of 6 total)
  • You need to reset the cookie, it is naturally set to 10 days.

    add_action('wp_head', 'setCookiePasswordTime');
    
    function setCookiePasswordTime()    {
        setcookie('wp-postpass_' . COOKIEHASH, $_POST['post_password'], time() + 10, COOKIEPATH);
    }

    This sets the cookie to expire after 10 seconds, you can set it to whatever you like. Just put this code in your functions.php file.

    Thread Starter tomas2r

    (@tomas2r)

    Ouch! That zapped the entire site when I updated the .php . I get all pages blank, and can’t login via admin. I will have to access the FTP area to edit this out.

    I tried the same code in my wp-includes/functions.php and it blew up my site up.
    Error
    Fatal error: Call to undefined function add_action() in /home/specialc/public_html/wp-includes/functions.php on line 29

    [ Please do not bump, that’s not permitted here. ]

    You have to put this in your theme’s functions.php file.

    Plugin Author Julio Potier

    (@juliobox)

    Hello

    This is the way WordPress does his thing with post password.

    @graphfx21 : you can’t do a set cookie in the header, you have to do it in “template_redirect” for example.

    I edited the themes/canvas/functions.php and got this error message
    html/wp-content/themes/canvas/header.php:22) in /home/specialc/public_html/wp-content/themes/canvas/functions.php on line 97

    Could you please tell us exactly which file to add the code to? I do not have a file called template_redirect.

    Thanks

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Login automatic after browser close’ is closed to new replies.