• ankitvatsa

    (@ankitvatsa)


    Suppose a user gives incorrect username while login, he gets an error message,

    Invalid Username, Forgot your password?

    I want to change this error message. How to do that ?

Viewing 1 replies (of 1 total)
  • Hmm, this is a WordPress core message and does not have a direct filter. The login provides a filter, but this is a filter on the concatenated login error messages, so if there is more than one error, it could be a bit tricky. You could try an str_replace():

    function change_invalid_username_message( $message ) {
        return str_replace( sprintf(__('<strong>ERROR</strong>: Invalid username. <a href="%s" title="Password Lost and Found">Lost your password</a>?'), site_url('wp-login.php?action=lostpassword', 'login')), 'Your message here.', $message );
    }
    add_filter( 'login_errors', 'change_invalid_username_message' );
Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: Theme My Login] Custom error message for failed login’ is closed to new replies.