Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在自定义wordpress页面中显示登录错误而不是wp-login.php_Wordpress - Fatal编程技术网

如何在自定义wordpress页面中显示登录错误而不是wp-login.php

如何在自定义wordpress页面中显示登录错误而不是wp-login.php,wordpress,Wordpress,我在弹出窗口中使用wordpress登录。但在登录失败或用户未在登录前验证电子邮件后,其将重定向到wp-login.php并显示错误消息。我需要显示在一个自定义页面,其中包括我的模板,以显示此错误消息。我已经检查了不同的论坛,并在theme functions.php中添加代码,但它不起作用 add_action( 'wp_login_failed', 'my_front_end_login_fail' ); // hook failed login function my_front_end

我在弹出窗口中使用wordpress登录。但在登录失败或用户未在登录前验证电子邮件后,其将重定向到wp-login.php并显示错误消息。我需要显示在一个自定义页面,其中包括我的模板,以显示此错误消息。我已经检查了不同的论坛,并在theme functions.php中添加代码,但它不起作用

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; } }