3

I want to override the phrase "Registration complete. Please check your e-mail." without modifying the core code in wp-login.php

Does anyone know what the add_filter() or add_action() might look like?

Thanks.

4

After wp-login.php figures out what error messages to display, the $errors object gets passed through the wp_login_errors filter:

$errors = apply_filters( 'wp_login_errors', $errors, $redirect_to );

When that error message is added to the list of "errors", wp-login uses the code 'registered', which you can use to narrow down your search.

So something like this should do it (untested, but this is the basic flow of the code):

add_filter( 'wp_login_errors', 'override_reg_complete_msg', 10, 2 );
function override_reg_complete_msg( $errors, $redirect_to ) {
   if( isset( $errors->errors['registered'] ) ) {
     $needle = __('Registration complete. Please check your e-mail.');
     foreach( $errors->errors['registered'] as $index => $msg ) {
       if( $msg === $needle ) {
         $errors->errors['registered'][$index] = 'Your new message';
       }
     }
   }

   return $errors;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy