Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

Update Cookie Expiration Period

Stay Logged Into WordPress for 1 year.

function custom_cookie_expiration( $length, $user_id, $remember ) {
	return YEAR_IN_SECONDS;
}
add_filter( 'auth_cookie_expiration', 'custom_cookie_expiration', 10, 3 );