Skip to content

Instantly share code, notes, and snippets.

@boogah
Created October 18, 2016 16:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save boogah/29c0dbe7316f45934c2d488463e20106 to your computer and use it in GitHub Desktop.
Save boogah/29c0dbe7316f45934c2d488463e20106 to your computer and use it in GitHub Desktop.
Biscotti bakes your WordPress logged in user cookie for an extended period of time.
<?php
/**
* Biscotti
*
* Biscotti is a plugin that changes the expiration of the logged in user
* cookie in WordPress to one year. Because some people hate entering
* their passwords.
*
* @link https://gist.github.com/boogah/29c0dbe7316f45934c2d488463e20106
* @package Biscotti
* @author Jason Cosper <boogah@gmail.com>
* @license GPL-2.0+
*
* @wordpress-plugin
* Plugin Name: Biscotti
* Plugin URI: https://gist.github.com/boogah/29c0dbe7316f45934c2d488463e20106
* Description: Bakes your cookie for an extended period of time.
* Version: 1.0.0
* Author: Jason Cosper
* Author URI: https://jasoncosper.com/
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
/**
* Set the login cookie's expiration date to one year.
*
* @since 1.0.0
* @param int $expirein Seconds.
*/
function biscotti_wp_cookie_logout( $expirein ) {
return 31556926;
}
add_filter( 'auth_cookie_expiration', 'biscotti_wp_cookie_logout' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment