Skip to content

Instantly share code, notes, and snippets.

@zergiocosta
Last active September 3, 2020 15:43
Show Gist options
  • Save zergiocosta/72f87176b236ed0c6e13 to your computer and use it in GitHub Desktop.
Save zergiocosta/72f87176b236ed0c6e13 to your computer and use it in GitHub Desktop.
Changing login error message (wp-admin)
<?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