Skip to content

Instantly share code, notes, and snippets.

@lillyfreitas
Forked from zergiocosta/custom_error_msgs.php
Last active May 26, 2020 02:41
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save lillyfreitas/fb5744f776af11f9958f2c8744139dfb to your computer and use it in GitHub Desktop.
Save lillyfreitas/fb5744f776af11f9958f2c8744139dfb to your computer and use it in GitHub Desktop.
Mensagens de erro de login (wp-admin)
<?php
/*
*
* Plugin Name: Mensagens de erro de login
* Description: Mensagens aleatórios e personalizadas para tentativas fracassadas de login.
* Version: 1.1
* Author: LFreitas based on Sergio Costa (zergiocosta)
* Text Domain: custom-error-msgs
*
* source: https://gist.github.com/zergiocosta/72f87176b236ed0c6e13
*
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
function guwp_error_msgs() {
// insert how many msgs you want as an array item. it will be shown randomly
$custom_error_msgs = array(
'<strong>YOU</strong> SHALL NOT PASS!',
'<strong>HEY!</strong> GET OUT OF HERE!',
'<strong>NO</strong>.',
'Did you bring a <strong>shrubbery</strong>?',
);
// get random array item to show
return $custom_error_msgs[array_rand($custom_error_msgs)];;
}
add_filter( 'login_errors', 'guwp_error_msgs' );
?>
@lillyfreitas
Copy link
Author

lillyfreitas commented Nov 6, 2017

Instead of changing in the functions.php, include as a site-specific plugin.
The file must be in /wp-content/plugins/ and the plugin must be active via WP Dashboard.


Em vez de editar o functions.php, colocar como um plugin personalizado.
O arquivo deve estar na pasta /wp-content/plugins/ e o plugin deve ser ativado pelo Painel do WP.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment