In WordPress, the user can set a strong or weak password for the user account. Using weak passwords for user accounts or keeping the same password for a long time can create security threats on your site. Regularly changing the account password is one way of preventing such threats on the site. Even though this is a commonly known fact, many users don't change their passwords. As a solution, we can make the existing password automatically expire and force the user to reset the password to get access again.
In this recipe, we are going to use custom code to make the existing password automatically expire within a predefined time frame and ask the user to reset their password to get access to the site.