• Resolved container

    (@container)


    global $wp_query;
    $wp_query->set_404();
    echo wp_login_url();

    The meaning of the above code is that it jumps the site to a 404 page and outputs the login page of the site as a string afterward.

    However, after enabling WPS Hide Login plugin and using the above code in the website, wp_login_url() will return the string “#” instead of the correct login address. After disabling the WPS Hide Login plugin wp_login_url() returns the normal login address.

    I think this is caused by a bug in the WPS Hide Login plugin and you can reproduce the issue in your project using the three lines of code above.

    • This topic was modified 2 years, 9 months ago by container.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter container

    (@container)

    public function login_url($login_url, $redirect, $force_reauth) {
        if (is_404()) {
            return '#';
        }
    
        if ($force_reauth === false) {
            return $login_url;
        }
    
        if (empty($redirect)) {
            return $login_url;
        }
    
        $redirect = explode('?', $redirect);
    
        if ($redirect[0] === admin_url('options.php')) {
            $login_url = admin_url();
        }
    
        return $login_url;
    }

    Oops! I found the above code in the plugin, it seems the plugin is intentionally setting the 404 status to return '#', but I guess not everyone expects this, sometimes I would like to provide a button on the error page for the user to log in or something like that, so would it be possible to provide a switch on the Settings page for this function?

    Switch on would output '#', otherwise the correct link.

    Plugin Support MaximeWPS

    (@seinomedia)

    Hello,

    Thanks for using WPS Hide Login.

    You can set a personalized slug for 404 in WPS Hide Login settings below the secret slug field.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Plugin doesn’t work after $wp_query->set_404()’ is closed to new replies.