The default WordPress the password expiration is 24h which generally should be plenty of time.
You may run into cases where you or your clients may need a short or a longer period than the default expiration.

To modify the WordPress password expiration you need a code that hooks into password_reset_expiration and override it.

You can put this code into a custom plugin OR in functions.php of your current (hopefully a child) theme.

If you want to reduce the expiration time use this:

// How to reduce the password expiration to 8h
add_filter( 'password_reset_expiration', function( $expiration ) {
return 8 * HOUR_IN_SECONDS;
});

If you want to increase the time use this

// How to increase the password expiration to 48h
add_filter( 'password_reset_expiration', function( $expiration ) {
return 2 * DAY_IN_SECONDS;
});

 

For the expiration value you can use seconds or one of the WordPress time constants

https://codex.wordpress.org/Easier_Expression_of_Time_Constants

Disclaimer: The content in this post is for educational purposes only. Always remember to take a backup before doing any of the suggested steps just to be on the safe side.
Referral Note: When you purchase through a referral link (if any) on this page, we may earn a commission.
If you're feeling thankful, you can buy me a coffee or a beer