• Resolved bethimc

    (@bethimc)


    We are wondering if we can customize the login error message. Ideally, we want to give a warning to valid users that they only have X number of login attempts left before their account is locked. Barring that, we could just say they have a maximum of X attempts before their account is locked.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor mbrsolution

    (@mbrsolution)

    Hi, unfortunately at present there is no feature available in the plugin to customize the message displayed by WordPress.

    Kind regards

    Plugin Contributor wpsolutions

    (@wpsolutions)

    Hi @bethimc,
    Yes I think you can achieve what you want using the wordpress core filter for the errors.

    Here’s one way you could do it by putting something like the following in your theme’s functions.php file:

    add_filter('login_errors', 'filter_login_errors', 10, 1);	
    function filter_login_errors( $error ) {
    	if (empty($error)) return $error;
    	
    	$warning = '<br />You have 3 login attempts in total.';
    
    	return $error .= $warning;
    }

    The above will append the following message to whatever error is displayed:

    “You have 3 login attempts in total.”

    This is just a quick example to demonstrate how you could do it but I recommend that also do your own due diligence and you could add some extra checks such as checking the existing error string to see what the error message is and change your response accordingly.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Customize Login Error Message’ is closed to new replies.