Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

This comment has been minimized.

Copy link
Owner 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
You can’t perform that action at this time.