我已经为我的网站的用户创建了登录页面。它将用户重定向到该网站的另一个页面。为此,我使用了wordpress wp_login形式。尽管输入错误的凭据后,它将我重定向到 wp-login.php并显示错误消息。我尝试了一些代码,但它们仍然是重定向正在发生。我该如何解决它。有什么帮助吗?
("网址"(, "form_id" => "登录", "label_log_in" => ( "登录" (,
'echo' => true,
'remember' => true,
'form_id' => 'loginform',
'id_username' => 'user_login',
'id_password' => 'user_pass',
'id_remember' => 'rememberme',
'id_submit' => 'wp-submit',
'label_username' => __( 'Username or Email Address' ),
'label_password' => __( 'Password' ),
'label_remember' => __( 'Remember Me' ),
'value_username' => '',
'value_remember' => false
) );
add_action( 'wp_login_failed', 'my_front_end_login_fail' ); // hook failed login
function my_front_end_login_fail( $username ) {
$referrer = $_SERVER['HTTP_REFERER']; // where did the post submission come from?
// if there's a valid referrer, and it's not the default log-in screen
if ( !empty($referrer) && !strstr($referrer,'wp-login') && !strstr($referrer,'wp-admin') ) {
wp_redirect( $referrer . '?login=failed' ); // let's append some information (login=failed) to the URL for the theme to use
exit;
}
}