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 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.

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

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;
}
share|improve this answer
    
Ok, thanks @DaveRoss. I just tested it and still get Registration complete. Please check your e-mail. –  H. Ferrence Oct 25 '13 at 11:43
    
I did some digging and the add_filter() does not take the process to the function. So I think I need to test the filter differently somehow –  H. Ferrence Oct 25 '13 at 11:53
    
further it seems $errors is NULL as I tried dumping it during my registration process –  H. Ferrence Oct 25 '13 at 12:16
    
Nevermind @DaveRoss. Your's worked. It was my error. –  H. Ferrence Oct 25 '13 at 13:48
    
Awesome to hear! –  Dave Ross Oct 25 '13 at 14:40
add comment

Your Answer

 
discard

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.