Created
October 18, 2016 16:42
-
-
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.
This file contains 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 | |
/** | |
* 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