0

我目前正在 Wordpress 上使用 WooCommerce 开发一个电子商务网站。每当我登录一个不存在的用户名和密码时,都没有提示用户名或密码不正确的警告消息。我希望它看起来像这样。

登录页面中目标查找错误消息的图像

在此处输入图像描述

我希望你能帮助我。谢谢

4

1 回答 1

0

尝试这个:

add_filter('login_errors', 'filter_login_errors', 10, 1);   
function filter_login_errors( $error ) {
    $error_type = strpos($error, 'incorrect');
    if (is_int($error_type)) {
        $error = '<span style="color:red">Oops! It seems that your username or password is incorrect. Please try it again.</span>';
    }
    return $error;
}
于 2021-09-06T09:45:56.417 回答