-
-
Save lillyfreitas/fb5744f776af11f9958f2c8744139dfb to your computer and use it in GitHub Desktop.
Mensagens de erro de login (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 | |
/* | |
* | |
* 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' ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.