'How can WordPress limit the number of password resets?

Is there a way to limit the number of times a WordPress user can reset their password?

For example, if a user clicks reset password one after another within a short period of time, after the number of clicks reaches 3, the user will not be sent the password reset email for 24 hours.

By default, WordPress allows users to reset their passwords without limit, which will lead to a lot of spam and thus be restricted by email service providers.


Updated.

Two solutions were available on the web before the question was asked.

1 How to limit the number of forgotten password reset attempts in Wordpress? - This is the answer that already exists, but after testing, it did not work as expected.

2 Use the Ultimate Member plugin, which provides a feature option to limit the number of password reset attempts in Wordpress, but after testing, it is too bloated.

Is there any other better solution please? Any help, thanks in advance!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source