I need to change the default expiry time of the WordPress password recovery link. I’m not sure how to go about this, I need to set it to ~30+ days (Gross I know).
So far my searching has come up pretty empty. I have however found this little snipped $expiration_duration = apply_filters( 'password_reset_expiration', DAY_IN_SECONDS );
Obviously this won’t do it on it’s own. I have tried combinations of apply / add filter in my themes functions.php but to no avail. (Testing by setting the expiry time to 30s and then trying to login.)
Thanks!
1 Answer
I would think this would change it to a month:
add_filter( 'password_reset_expiration', function( $expiration ) {
return MONTH_IN_SECONDS;
});
using the built-in MONTH_IN_SECONDS
constant.
For a quick testing:
add_filter( 'password_reset_expiration', function( $expiration ) {
return 60; // A minute
});