Replies: 0
Hi,
Controlling incorrect user input and password has stopped working after updating the elementor plugin.
I had these lines written in my function.php file:
add_action( ‘wp_login_failed’, ‘elementor_form_login_fail’ );
function elementor_form_login_fail( $username ) {
$referrer = $_SERVER[‘HTTP_REFERER’];
if ( !empty($referrer) && !strstr($referrer,’wp-login’) && !strstr($referrer,’wp-admin’) ) {
wp_redirect(preg_replace(‘/\?.*/’, ”, $referrer) . ‘?login=failed’ );
exit;
}
}
add_filter( ‘authenticate’, ‘custom_authenticate_username_password’, 30, 3);
function custom_authenticate_username_password( $user, $username, $password )
{
if ( is_a($user, ‘WP_User’) ) { return $user; }
if ( empty($username) || empty($password) )
{
$error = new WP_Error();
$user = new WP_Error(‘authentication_failed’, __(‘ERROR: Invalid username or incorrect password.’));
return $error;
}
}
Before everything works succesfully and now all this do not anything
You can test how if you introduce a wrong user and password goes to another page (before not happen)
Someone could help me? Thank you