Title: Create custom validation for registration fields programmatically
Last modified: November 20, 2020

---

# Create custom validation for registration fields programmatically

 *  Resolved [cln00](https://wordpress.org/support/users/cln00/)
 * (@cln00)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/create-custom-validation-for-registration-fields-programmatically/)
 * I followed the documentation and another answer here about using your specific
   hooks to define custom validation, it worked with “user_registration_validate_user_email”
   but once I change it to “user_registration_validate_[field_name]” it won’t work,
   is it specific for email and username only ?
 * // add_action( ‘user_registration_validate_number_box_1605799382′,’ur_validate_number_box_1605799382_field’,
   10,4);
    // function ur_validate_number_box_1605799382_field($single_form_field,
   $data, $filter_hook, $form_id) { // $field_label = isset( $data->label ) ? $data-
   >label : ”; // $value = isset( $data->value ) ? $data->value : ”;
 * // if( condition ) {
    // add_filter( $filter_hook, function ( $msg ) use ( $field_label){//
   return __( $field_label . ‘Please enter a valid number.’, ‘user-registration’);//});//}//}

Viewing 1 replies (of 1 total)

 *  Plugin Support [sanjuacharya77](https://wordpress.org/support/users/sanjuacharya77/)
 * (@sanjuacharya77)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/create-custom-validation-for-registration-fields-programmatically/#post-13712321)
 * Hi [@cln00](https://wordpress.org/support/users/cln00/),
 * We had received your support ticket in our email support and the issue has been
   fixed via email support. Feel free to write to us if you have any other queries
   and I will get back to you.
 * Thanks and Regards!

Viewing 1 replies (of 1 total)

The topic ‘Create custom validation for registration fields programmatically’ 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/)

 * 1 reply
 * 2 participants
 * Last reply from: [sanjuacharya77](https://wordpress.org/support/users/sanjuacharya77/)
 * Last activity: [5 years, 6 months ago](https://wordpress.org/support/topic/create-custom-validation-for-registration-fields-programmatically/#post-13712321)
 * Status: resolved