Fix AVADA theme / Woocommerce incompatibility with Profile Builder

This function will fix AVADA theme / Woocommerce incompatibility with Profile Builder.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/*
 * Fix AVADA theme / Woocommerce incompatibility with Profile Builder. 
 * On login, errors were not reported correctly.
 * It broke on the do_action( 'wp_login_failed', $username ) hook.
 * Tags: woocommerce, avada theme, wp_login_failed
 */
 
add_action( 'after_setup_theme', 'wppbc_remove_avada_redirect' );
function wppbc_remove_avada_redirect(){
   remove_action( 'init', 'avada_load_login_redirect_support' );
}
 
add_filter( 'init', 'wppb_avada_authenticate_compat' );
function wppb_avada_authenticate_compat() {
   add_filter( 'authenticate', 'wp_authenticate_username_password', 20, 3 );
   remove_filter( 'authenticate', 'avada_email_login_auth', 20, 3 );
}