Lets each user pick how long their "Remember Me" login lasts: the WordPress default of 14 days, three months, six months, or a year.
WordPress logs you out after 14 days, even when you check "Remember Me." On a site you visit every day from the same laptop, that means retyping your password twice a month.
Some folks hate having to keep entering their passwords. Biscotti lets each user stretch their own login cookie and leaves everyone else on the default.
Biscotti adds a "Login Cookie Expiration" dropdown to the profile screen and stores the choice in the biscotti_login_cookie_expiration user meta key.
At login, Biscotti filters auth_cookie_expiration. When the user checked "Remember Me," it swaps core's 14 days for the length they picked. Logins without "Remember Me" keep core's two-day browser session limit, so a shared computer never holds a login that lasts for months.
Save a new length on your own profile and Biscotti re-issues your login cookie on the spot, as long as your current login used "Remember Me." It starts a fresh session with the new expiration and retires the old one.
Admins can set the length for other users from their profile screens. The change applies at that user's next "Remember Me" login.
- WordPress 6.0 or later
- PHP 8.3 or later
- Search for Biscotti under Plugins > Add New Plugin, or upload the
biscottidirectory to/wp-content/plugins/. - Activate it.
- Go to Users > Profile and pick a length under "Login Cookie Expiration."
Biscotti lives on WordPress.org and also supports Git Updater.
There's no settings page. Each user picks their own length on their profile:
- Default (14 days): the WordPress default
- 3 months (90 days)
- 6 months (180 days)
- 1 year (365 days)
Enjoy your long cookie.
<user> accepts a user ID, email, or login.
Check a user's setting:
wp biscotti get adminCookie expiration for admin (ID: 1): 1 year (365 days)
Change it. The value must be default, 3 months, 6 months, or 1 year:
wp biscotti set 123 '1 year'
wp biscotti set jane@example.com defaultDo I need to log out after changing the setting?
Nope, as long as you logged in with "Remember Me." Biscotti re-issues your cookie when you save. Otherwise, the new length kicks in the next time you check "Remember Me."
Why does it ignore logins without "Remember Me"?
Leaving that box unchecked asks WordPress to forget you when the browser closes. Browsers that restore your tabs on restart can restore session cookies too, so Biscotti leaves those logins at core's two days.
Can different users pick different lengths?
Yep. The setting lives on each user's profile.
What happens when I delete the plugin?
Biscotti deletes the biscotti_login_cookie_expiration meta for every user. Logins that are already active keep their current expiration until they run out or the user logs out.
Biscotti are long cookies. This plugin stretches how long your login cookie stays valid.
Ergo, long cookies.
Security
- Fixed long expirations applying to logins without "Remember Me." Those logins now keep core's two-day limit.
Added
- Added an instant cookie refresh when you save your own setting while logged in with "Remember Me."
- Added login and email lookups to
wp biscotti getandwp biscotti set.
Changed
- Changed uninstall to delete user meta with
delete_metadata(), so it no longer flushes the whole object cache. - Changed the
auth_cookie_expirationcallback to accept loosely typed arguments, so a plugin passingnullno longer causes a fatal error. - Changed the profile help text to explain the "Remember Me" requirement.
- Changed the minimum PHP version to 8.3.
Removed
- Removed the "settings updated" notice, which WordPress discarded on redirect before anyone saw it.
- Removed the text domain loader and
Domain Pathheader. WordPress.org loads translations without them.
Major Security & Feature Update
Security Improvements:
- CRITICAL: Added CSRF protection with nonce verification on profile form submissions
- Added input validation with whitelist checking for all user inputs
- Added user existence validation in WP-CLI commands
- Changed all loose comparisons (
==) to strict comparisons (===)
New Features:
- Added "Default (14 days)" option to allow users to revert to WordPress standard expiration
- Added full internationalization (i18n) support with text domain and translation functions
- Enhanced form descriptions with clearer explanations of each expiration option
- Improved WP-CLI commands with better output formatting and validation
- Added PHP 8.0+ type hints (parameter and return types) throughout
Code Quality:
- Added plugin constants for all magic strings and values
- Improved PHPDoc blocks with complete parameter and return documentation
- Switched from if/elseif chains to switch statements for better readability
- Enhanced error messages in WP-CLI commands
- Added
uninstall.phpto properly clean up user meta on plugin deletion - Updated form markup with ARIA roles for better accessibility
Added WP-CLI command. Bumped required PHP version to 8.0.
@webaware has decided to help make this code less awful and submitted a pull request. This release implements their improvements.
Sanitize. Not escape. Ack!
Forgot to escape the lone $_POST in my code. Feel dumb about it. Fixed now tho.
Rewrite! Now, instead of forcing everyone to use the same login cookie expiration, Biscotti allows users to individually select their login cookie expiration on their profile page.
Initial release. Simple plugin that forced login cookie expiration for every user to 1 year.
All plugin code is (currently) Jason Cosper's fault. Plugin header image courtesy of Terri Bateman. Plugin icon courtesy of Toora Khan from Noun Project.
GPL-2.0-or-later