Skip to content

Instantly share code, notes, and snippets.

@bolorino
Created September 28, 2014 17:42
Show Gist options
  • Save bolorino/1ec700e0e4ec8c4b748b to your computer and use it in GitHub Desktop.
Save bolorino/1ec700e0e4ec8c4b748b to your computer and use it in GitHub Desktop.
WordPress Plugin: Enable 403 status on login failed
<?php
/**
* Plugin Name: Security Auth
* Plugin URI: http://kovshenin.com/2014/fail2ban-wordpress-nginx/
* Description: Enable 403 status on login failed.
* Tags: security, login
* Version: 1.0
* License: GPLv2
* Author: Konstantin Kovshenin
* Author URI: http://kovshenin.com/
*
*/
if ( realpath(__FILE__) === realpath($_SERVER['SCRIPT_FILENAME']) )
exit('Do not access this file directly.');
function my_login_failed_403() {
status_header( 403 );
}
add_action( 'wp_login_failed', 'my_login_failed_403' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment