[Defender] Geo-based IP blocking only for login screen


I like th enew Geo-based IP blocking in Defender. But I would like it more if this could be set only for the login screen!

Gr, Age

  • Ash
    • WordPress Hacker

    Hello jongag1

    This is not possible out of the box, but you can enable this if you modify the plugin with a bit of custom code.

    Please go to /wp-content/plugins/wp-defender/app/module/ip-lockout/model/settings.php and on line 428 you will see the following line:

    public function isCountryBlacklist() {

    Just after this line, add the following code:

    if ( $GLOBALS['pagenow'] != 'wp-login.php' ) {

    Please note that, this change will be lost when you update the plugin. So, please note down the changes somewhere and apply again after updating the plugin.

    Hope it helps! Please feel free to ask more questions if you have any.

    Have a nice day!


Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.