Last active
September 3, 2020 15:43
-
-
Save zergiocosta/72f87176b236ed0c6e13 to your computer and use it in GitHub Desktop.
Changing login error message (wp-admin)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Insert into your functions.php and have fun by creating login error msgs | |
function guwp_error_msgs() { | |
// insert how many msgs you want as array items. it will be shown randomly (html is allowed) | |
$custom_error_msgs = [ | |
'<strong>YOU</strong> SHALL NOT PASS!', | |
'<strong>HEY!</strong> GET OUT OF HERE!', | |
]; | |
// get and returns a random array item to show as the error msg | |
return $custom_error_msgs[array_rand($custom_error_msgs)]; | |
} | |
add_filter( 'login_errors', 'guwp_error_msgs' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment