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

1 Answer 1

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
    
Awesome to hear! –  Dave Ross Oct 25 '13 at 14:40
    
This doesn't work on WP4. For a working solution, please see this answer: wordpress.stackexchange.com/a/161722/24875 –  Christine Cooper Sep 17 at 17:39

Your Answer

 
discard

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