In this article, we will explain how to extend your user login session on WordPress.
Follow these steps to extend the user login session on WordPress.
- Log into WordPress.
- In the left sidebar on the Dashboard, select “Appearance,” and then choose “Theme Editor.”
- In the Theme Editor, pick the desired Theme from the drop-down menu.
- Now, click on the file named “functions.php”
- Enter the following code into functions.php-
add_filter( 'auth_cookie_expiration', 'extend_login_session' ); function extend_login_session( $expire ) { return 31556926; // seconds for 1 year time period }
- Now, save the file and exit from the editor.
- The login session now lasts for 1 year, surpassing the default duration set by the login session cookie.
In this way, you extend user login session on WordPress. For more information on WordPress, visit our knowledge base section.