WordPress Snippets at WPcustoms

Force a minimum password length at checkout

Force an 8 letter minimum password length for easy digital download customer signups


/**
 * Snippet Name: Force a minimum password length at checkout
 * Snippet URL: http://www.wpcustoms.net/snippets/force-minimum-password-length-checkout/
 */
 function edd_set_minimum_password_length( $valid_data, $post_data  ) {
	if ( strlen( $post_data['edd_user_pass'] ) < 8 ) {
		edd_set_error( 'password_too_short', __( 'Please enter a password of 8 characters or more.', 'edd' ) );
	}
}
add_action( 'edd_checkout_error_checks', 'edd_set_minimum_password_length', 10, 2 );