-
-
Save salcode/19c965332edb9afb9cf3 to your computer and use it in GitHub Desktop.
Code to add to the beginning wp-config.php that causes WordPress to shutdown without ever connecting to the database if someone tries to login with the username "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 | |
// ** Reject Bad Username ** // | |
/** As described on http://salferrarello.com/wordpress-bad-login-attempts/ **/ | |
$bad_user_names = array( 'admin' ); | |
if ( | |
isset( $_POST['log'] ) | |
&& in_array( strtolower( $_POST['log'] ), $bad_user_names ) | |
&& false !== stripos( $_SERVER['REQUEST_URI'], 'wp-login.php' ) | |
) { | |
die(); | |
} | |
// ** MySQL settings ** // | |
/** The name of the database for WordPress */ | |
define('DB_NAME', 'example'); | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment