Saturday, September 17, 2022
HomeWordPress Developmentcookies - Modify the third (context) parameter in a filter?

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


I perceive that the next filter modifies the parameters of the authentication cookies, in reality I’ve managed to change its worth since it’s the first parameter $cookie, however what I would like is to change the parameter $expiration that interprets to Expires within the cookie.

So how might I modify the third parameter $expiration provided that solely $cookie could be returned and the remainder appear to be in context?

add_filter( "auth_cookie", "modify_auth_cookie_defaults", 10, 5 );
operate 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 );
operate modify_auth_cookie_defaults($cookie, $user_id, $expiration, $scheme, $token) { 
$expiration = YEAR_IN_SECONDS
return $expiration; 
}


RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments