Skip to content

Instantly share code, notes, and snippets.

@Coopeh
Created May 23, 2013 13:05
Show Gist options
  • Save Coopeh/5635891 to your computer and use it in GitHub Desktop.
Save Coopeh/5635891 to your computer and use it in GitHub Desktop.
Error log out bad auth on wp-login failure
add_action('wp_login_failed', 'log_wp_login_fail');
function log_wp_login_fail($username) {
$ip = ($_SERVER['REMOTE_ADDR'] != '127.0.0.1') ? $_SERVER['REMOTE_ADDR'] : $_SERVER['X_FORWARDED_FOR'];
error_log("Authentication failure for $username from {$ip}");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment