Custom Validation Not Working
-
Hello! I am in the process of setting up a site and I need to use custom field validation to verify a few questions to ensure users are eligible for membership.
For testing, I’ve copied and pasted the code from the documentation page into the functions.php of my active theme
/** * Validate field T2N_Code * @param string $key * @param attay $array * @param array $args */ function um_custom_validate_username( $key, $array, $args ) { if ( isset( $args[$key] ) && $args[$key] !== 'test' ) { UM()->form()->add_error( $key, __( 'Please enter valid code.', 'ultimate-member' ) ); } } add_action( 'um_custom_field_validation_T2N_Code', 'um_custom_validate_username', 30, 3 );And set the custom validation action to ‘T2N_Code’, as is done on the documentation page.
Despite this, when I go to sign up, the form accepts any answer for this field. No error is shown, the signup simply succeeds, regardless of what is entered.
Any help would be appreciated!
The page I need help with: [log in to see the link]
The topic ‘Custom Validation Not Working’ is closed to new replies.