Title: Validation for password
Last modified: November 2, 2021

---

# Validation for password

 *  Resolved [kimphuongtu135](https://wordpress.org/support/users/kimphuongtu135/)
 * (@kimphuongtu135)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/validation-for-password/)
 * Hello,
 * I am trying to implement validation for the password field. For example, maximum
   of 10 letters, containing capital letters and special characters. Is that anyway
   I can do it?
    Thank you

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [Sandip Pokhrel](https://wordpress.org/support/users/sandippokharel/)
 * (@sandippokharel)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/validation-for-password/#post-15046055)
 * Hi [@kimphuongtu135](https://wordpress.org/support/users/kimphuongtu135/)
 * Thanks for writing in,
 * For limit the character, please add the following code in functions.php of you
   theme file.
 *     ```
       add_action( 'user_registration_validate_user_pass', 'ur_validate_user_pass_field', 10, 4 );
       function ur_validate_user_pass_field( $single_form_field, $data, $filter_hook, $form_id ) {
       	$field_label = isset( $data->label ) ? $data->label : '';
       	$password       = isset( $data->value ) ? $data->value : '';
       	if ( 10 < strlen( $password ) ) {
       		add_filter(
       		$filter_hook,
       		function ( $msg ) use ( $field_label ) {
       		return __( $field_label . ' cannot exceed 10 characters.', 'user-registration' );
       		}
       		);
       	}
       }
       ```
   
 * Also, you can use ‘Enable Strong Password’ feature in the Form Setting to ask
   users to enter strong passwords.
 * Regards!
    WPEverest Support Team.
 *  [Sandip Pokhrel](https://wordpress.org/support/users/sandippokharel/)
 * (@sandippokharel)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/validation-for-password/#post-15053561)
 * Hi [@kimphuongtu135](https://wordpress.org/support/users/kimphuongtu135/),
 * Since you haven’t written us back for few days/weeks, you are going to mark this
   ticket as resolved.
    Please let us know if you have any questions.
 * Regards!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Validation for password’ is closed to new replies.

 * ![](https://ps.w.org/user-registration/assets/icon-256x256.gif?rev=3284028)
 * [User Registration & Membership - Free & Paid Memberships, Subscriptions, Content Restriction, User Profile, Custom User Registration & Login Builder](https://wordpress.org/plugins/user-registration/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/user-registration/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/user-registration/)
 * [Active Topics](https://wordpress.org/support/plugin/user-registration/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/user-registration/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/user-registration/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Sandip Pokhrel](https://wordpress.org/support/users/sandippokharel/)
 * Last activity: [4 years, 7 months ago](https://wordpress.org/support/topic/validation-for-password/#post-15053561)
 * Status: resolved