cookies – Modify the third (context) parameter in a filter?

Question

I understand that the following filter modifies the parameters of the authentication cookies, in fact I have managed to modify its value since it is the first parameter $cookie, but what I need is to modify the parameter $expiration that translates to Expires in the cookie.

So how could I modify the third parameter $expiration given that only $cookie can be returned and the rest seem to be in context?

add_filter( "auth_cookie", "modify_auth_cookie_defaults", 10, 5 );
function modify_auth_cookie_defaults($cookie, $user_id, $expiration, $scheme, $token) { 

return str_replace( $expiration, DAY_IN_SECONDS, $expiration );
}

add_filter( "auth_cookie", "modify_auth_cookie_defaults", 10, 5 );
function modify_auth_cookie_defaults($cookie, $user_id, $expiration, $scheme, $token) { 
$expiration = YEAR_IN_SECONDS
return $expiration; 
}


0
truemar 1 week 2022-09-16T17:39:07-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse