How to set custom validation for WordPress Passwords? Something like more than 12 chars, both numbers and letters, etc.

What filter should I use?

  • See validate_password_reset action. There are lots of examples around. – Max Yudin Feb 21 '17 at 14:06

By Using following hook, you can customize your login page and password validations with ajax or PHP.

add_action( 'login_form', 'myplugin_add_login_fields' );

function myplugin_add_login_fields() {

    //Get and set any values already sent
    $user_extra = ( isset( $_POST['user_extra'] ) ) ? $_POST['user_extra'] : '';

        <label for="user_extra"><?php _e('Extra Field','mydomain') ?><br />
            <input type="text" name="user_extra" id="user_extra" class="input" value="<?php echo esc_attr(stripslashes($user_extra)); ?>" size="25" /></label>


Let me know, I case of any issues.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.