简体   繁体   English

在Woocommerce中登录失败时重定向到自定义登录页面

[英]Redirect to custom login page on failed login in Woocommerce

It's easy to redirect a user to a custom login page using 'wp_login_failed' action. 使用“ wp_login_failed”操作将用户重定向到自定义登录页面很容易。 But it doesn't work in WooCommerce as it has its own wrapper. 但是它有自己的包装程序,因此在WooCommerce中不起作用。 I couldn't find an action for that. 我找不到为此采取的行动。

/**
 * Process the login form.
 */
public static function process_login() {
    $nonce_value = isset( $_POST['_wpnonce'] ) ? $_POST['_wpnonce'] : '';
    $nonce_value = isset( $_POST['woocommerce-login-nonce'] ) ? $_POST['woocommerce-login-nonce'] : $nonce_value;

    if ( ! empty( $_POST['login'] ) && wp_verify_nonce( $nonce_value, 'woocommerce-login' ) ) {
.......
.......
} catch ( Exception $e ) {
            wc_add_notice( apply_filters('login_errors', $e->getMessage() ), 'error' );
        }

Is there any solution for this issue? 这个问题有解决方案吗?

Thanks 谢谢

I reported this as in issue to WooCommerce, and fortunately, they added the hook. 我向WooCommerce报告了这个问题,幸运的是,他们添加了这个问题。

https://github.com/woothemes/woocommerce/issues/11864 https://github.com/woothemes/woocommerce/issues/11864

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM