我一直致力于Wordpress PHP代码,例如将wp-admin重定向到另一个URL字符串。它会将wp-admin更改为wp-login.php?mysecretstring = login。这工作正常,但它来到另一个URL,如wordpress重置密码&错误的密码重定向到404(wp-login.php?action = lostpassword)。是否可以排除丢失的密码网址或更改密码?
function protection_login_page() {
global $redux_demo;
$QS = $redux_demo['zx-wpadmin-protect-key'];
$httpconnection = $redux_demo['zx-wpadmin-protect-http'];
/* $QS = '?mysecretstring=foobar';*/
$theRequest = $httpconnection . $_SERVER['SERVER_NAME'] . '/' . 'wp-login.php' . '?'. $_SERVER['QUERY_STRING'];
$theRequestlost = $httpconnection . $_SERVER['SERVER_NAME'] . '/' . 'wp-login.php?action=lostpassword' . '?'. $_SERVER['QUERY_STRING'];
if ( site_url('/wp-login.php').$QS == $theRequest ) {
echo '<div style=" color: #fff;
background: rgba(0, 0, 0, 0.42);
text-align: center;
font-weight: 600;
text-transform: uppercase;">Redirect Working</div>';
} elseif ( site_url('/wp-login.php?action=lostpassword').$QS == $theRequestlost ) {
}else {
header('Location:/404.php');
}
}
add_action('login_head', 'protection_login_page');