'failed', 'reason' => 'empty', '_adlhpti_nonce' => wp_create_nonce( 'adlhpti_login_notice' ), ], home_url( '/' . $slug . '/' ) ); wp_safe_redirect( $redirect_url ); exit; } // Check for invalid username if ( ! username_exists( $username ) ) { $slug = trim( get_option( 'adlhpti_custom_login_slug', 'secure-login' ), '/' ); $redirect_url = add_query_arg( [ 'login' => 'failed', 'reason' => 'invalid_username', '_adlhpti_nonce' => wp_create_nonce( 'adlhpti_login_notice' ), ], home_url( '/' . $slug . '/' ) ); wp_safe_redirect( $redirect_url ); exit; } return $user; } // Handle incorrect password add_action( 'wp_login_failed', 'adlhpti_redirect_on_login_failed' ); function adlhpti_redirect_on_login_failed( $username ) { $is_enabled = get_option( 'adlhpti_enabled', false ); if ( ! $is_enabled ) { return; } $slug = trim( get_option( 'adlhpti_custom_login_slug', 'secure-login' ), '/' ); $redirect_url = add_query_arg( [ 'login' => 'failed', 'reason' => 'wp_login_failed', '_adlhpti_nonce' => wp_create_nonce( 'adlhpti_login_notice' ), ], home_url( '/' . $slug . '/' ) ); wp_safe_redirect( $redirect_url ); exit; }