• Hello, I am interested in never closing the session started. So I found out that if there are two cookies
    wordpress_sec_[hash] which has an Expires: Session parameter and is set when you log in along with others.

    Well, if I close the browser and open it again I will have to log in again with my credentials but if I manually modify the Expires parameter of the wordpress_sec_[hash] for one year from the console, for example, then the session lasts.

    I tried to use a snippet:

    add_filter ( 'auth_cookie_expiration', 'wpdev_login_session' );
    function wpdev_login_session( $expire ) {
        return YEAR_IN_SECONDS;
    }

    but this snippet doesn’t change any of those cookies at all and has no effect on the length of the user’s session, at least in my case.

    So, is there a way to modify the Expires parameter of the wordpress_sec_[hash] cookies through a filter?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz

    (@bcworkz)

    Do you have a security plugin? My site doesn’t set any cookie of the form wordpress_sec_[hash]. I only have wordpress_[hash] and wordpress_logged_in_[hash], plus a test cookie.

    If it’s set by a security plugin, ask its devs through their dedicated support channel what you could do. If all else fails, I believe the expiration can be updated via JavaScript, but the presence of a hash could make it difficult to implement.

    Thread Starter ashop59

    (@ashop59)

    Thanks, I’m still working on it. I have some problem with the rest api in my site.

    • This reply was modified 2 years, 5 months ago by ashop59.
    • This reply was modified 2 years, 5 months ago by ashop59.
    • This reply was modified 2 years, 5 months ago by ashop59.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘configure the duration of cookies wordpress_sec_’ is closed to new replies.