Defender lockout screen customization hooks

Are there any hooks/templates that would allow full customization of lockout screens (Login/IP/404 bans)? There are options to customize messages via Defender’s settings page but the goal is to create fully customized “security pages”, preferably via a custom mu plugin.

  • Katya Tsihotska
    • Support & QA

    Hi Micha

    Hope you’re having a wonderful day!

    Since this is dealing with more advanced coding topics, I’m going to ping our SLS Team (code experts) to get their valuable feedback on this question. One of our SLS members will reply back here as soon as more information is available.

    Please keep in mind that our SLS Team deals with more complicated issues, thus it may take a little longer for them to reply here. Thank you for your patience while we look into this further.

    Meantime, you can find template of the lockout page at the /wp-content/plugins/wp-defender/app/module/ip-lockout/view/locked.php

    However, any changes that you’ll make there will be overridden with the plugin update, but you can use it as the workaround while we are waiting for the response of our SLS team.

    Kind regards,


  • Micha
    • Recruit

    I understand this may take a little more time. What I’m asking for is hooks so that I can modify the content and add my own content to the mix of this page.

    I probably will customize that locked.php page, but that obviously isn’t a long term solution. Thanks!

  • Ivan
    • Developer

    Hi Micha !

    You can try to add this function to {wordpress_folder}/wp-content/plugins/wp-defender/app/controller.php file via FTP

    * <a title=param href=/profile/param>param</a> $viewFile
    * <a title=param href=/profile/param>param</a> array $params
    * <a title=param href=/profile/param>param</a> bool $echo
    * @return bool|string
    public function renderPartial( $viewFile, $params = array(), $echo = true ) {
    $content = parent::renderPartial( $viewFile, $params, $echo );

    $content = apply_filters( 'wd_render_partial', $content, $viewFile, $params );
    if ( $echo ) {
    echo $content;

    return $content;

    Please, add this code before the last curly brace in this file.

    I also will provide this code to the next version of the plugin.

    Then, you can use it via MU plugin.

    function wpmu_defender_change_locked_template( $content, $viewFile, $params ) {
    if ( 'locked' === $viewFile ) {
    include_once get_stylesheet_directory() . DIRECTORY_SEPARATOR . 'defender' . DIRECTORY_SEPARATOR . 'locked.php';
    $content = ob_get_clean();
    return $content;
    add_filter( 'wd_render_partial', 'wpmu_defender_change_locked_template', 10, 3 );

    And add a new locked.php file to defender folder of your current child theme.

    Note: in the new locked.php file you should use $params instead of $message variable



  • Micha
    • Recruit

    Hey Ivan,

    I’m very sorry I lost track of this thread. I got pulled to several way more important things for my client site. I am just not revisiting this and would like to test this code. However, short of actually locking my self out, how can I preview this lockout page? I can’t do it by visiting the direct php file in the child theme because of permissions.


Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.