Bloqueia o IP após 5 tentativas de login falhas por 1 hora, sem precisar de plugin.
add_filter('authenticate', function ($user, $username, $password) {
$ip = $_SERVER['REMOTE_ADDR'];
$key = 'login_attempts_' . md5($ip);
$attempts = (int) get_transient($key);
if ($attempts >= 5) {
return new WP_Error('too_many_attempts', 'Muitas tentativas. Tente novamente em 1 hora.');
}
if ($username && $password && is_wp_error($user)) {
set_transient($key, $attempts + 1, HOUR_IN_SECONDS);
}
if (!is_wp_error($user)) {
delete_transient($key);
}
return $user;
}, 30, 3);