set password strength woocommece without plugin code example

Example: Woocommerce password strength change

add_filter( 'woocommerce_min_password_strength', 'reduce_min_strength_password_requirement' );
function reduce_min_strength_password_requirement( $strength ) {
    // 3 => Strong (default) | 2 => Medium | 1 => Weak | 0 => Very Weak (anything).
    return 2; 
}

# change the wording of the password hint.
add_filter( 'password_hint', 'indic_password_hint' );
function indic_password_hint ( $hint ) {
    $hint = 'Hint: To make it stronger, use upper and lower case letters, numbers, and symbols like ! " ? $ % ^ & ).';
    return $hint;
}

# to remove password hint and strendth check
function indic_remove_password_strength() {
    wp_dequeue_script( 'wc-password-strength-meter' );
}
add_action( 'wp_print_scripts', 'indic_remove_password_strength', 10 );

Tags:

Php Example