Skip to content

Instantly share code, notes, and snippets.

@salcode salcode/wp-config.php Secret
Last active Aug 29, 2015

Embed
What would you like to do?
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"
<?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
You can’t perform that action at this time.