Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I need to add a field to the user registration form and then validate it before I add a new user to my WordPress

I know how to hook into the registration form via add_filter('register_form', 'my_function');

But how do I hook into the registration process before the user registers? Hence I do not want add_action('user_register','my_other_function');.

share|improve this question

2 Answers 2

up vote 2 down vote accepted

You need to create your own hook for registration_errors filter:

add_filter( 'registration_errors', 'wpse8170_registration_errors', 10, 3 );
function wpse8170_registration_errors( $errors, $sanitized_user_login, $user_email ) {
    if ( /* something happens */ ) {
        $errors->add( 'myexception_code', 'This is my message' );

    return $errors;
share|improve this answer
Thanks @EugeneManuilov -- I'll give this a try.... –  H. Ferrence Oct 10 '13 at 20:23
Awesome @EugeneManuilov ... thanks ! –  H. Ferrence Oct 10 '13 at 21:04

Take a look at the WordPress Codex: Customizing The Registration Form

Theme and plugin developers can customize WordPress's built-in user registration page through the use of hooks.

Customizing the registration form involves utilizing the following three hooks:

  1. register_form
    Allows rendering of new HTML form elements.
  2. registration_errors
    Perform validation on form registration fields.
  3. user_register
    Save custom form data.
share|improve this answer
+1 for good reference ;) –  Eugene Manuilov Oct 10 '13 at 21:11
Haha...thanks @EugeneManuilov...I was just thinking, wait a minute isn't that pretty good documented, I guess for an answer it's a bit on the edge though. –  ialocin Oct 10 '13 at 21:27

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.