Numbers are not allowed in Name fields
-
Hi
I wanted to customize validation in Billing section , so I use this code and it did work.
if ( ! function_exists( ‘wmsc_validate_fname_lname’ ) ) {
function wmsc_validate_fname_lname( $errors, $fields ) {
if ( preg_match( ‘/\\d/’, $fields[ ‘billing_first_name’] ) ) {
$errors[ ‘billing_first_name’ ] = __( ‘<b>Billing First name</b> field does not allow numbers.’ );
}
if ( preg_match( ‘/\\d/’, $fields[ ‘billing_last_name’] ) ) {
$errors[ ‘billing_last_name’ ] = __( ‘<b>Billing Last name</b> field does not allow numbers.’ );
}
return $errors;
}
}
add_action( ‘wmsc_custom_validation’, ‘wmsc_validate_fname_lname’, 10, 2 );But the problem is I can’t translate “Billing Last name field does not allow numbers.” into Chinese in this way.
Is there a way to adjust it into text so that I could translate it into Chinese?Regards
The topic ‘Numbers are not allowed in Name fields’ is closed to new replies.