简体   繁体   中英

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. But it doesn't work in WooCommerce as it has its own wrapper. 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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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