Problem/Use Case:
Users may try to set weak passwords, compromising security.
Snippet:
// Force strong passwords
function enforce_strong_passwords($errors, $update, $user) {
if (!empty($_POST['pass1']) && strlen($_POST['pass1']) < 10) {
$errors->add('password_too_short', 'Password must be at least 10 characters long.');
}
}
add_action('user_profile_update_errors', 'enforce_strong_passwords', 10, 3);
Explanation: Forces users to use stronger passwords when updating profiles.
Where to Place It: In functions.php.