-
-
Save davidmutero/a8795969c7ef75febe592e0239d43d99 to your computer and use it in GitHub Desktop.
Extends the user login period to one year for all users, regardless of the "Remember Me" option.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Plugin Name: Persistent Login for All Users | |
| * Description: Extends the user login period to one year for all users, regardless of the "Remember Me" option. | |
| * Version: 1.0 | |
| * Author: Your Name | |
| * | |
| * @link https://developer.wordpress.org/reference/hooks/auth_cookie_expiration/ | |
| * | |
| * Usage: This plugin extends the login period for all users to one year without requiring them to select the "Remember Me" option. | |
| * It can be added by creating a custom plugin or using the Code Snippets plugin. | |
| */ | |
| function my_user_persistent_login( $expiration, $user_id, $remember ) { | |
| return YEAR_IN_SECONDS; // Adjust as needed, e.g., YEAR_IN_SECONDS * 2 for two years. | |
| } | |
| add_filter( 'auth_cookie_expiration', 'my_user_persistent_login', 10, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment