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.
No, that’s not true
is_ user_ logged_ In () is used to detect whether a user is logged in.
While is_ Login () is used to detect whether the user is on the login page.
Their functions are completely different.