• Resolved entrenadorbomberoscm

    (@entrenadorbomberoscm)


    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

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Hello @entrenadorbomberoscm ,
    It is not LoginPress causing this issue as I have tested this code as well.

    You can test whether LoginPress is causing this or not by deactivating LoginPress and try to replicate this, I tried and failed to do so.
    So, this is an Elementor related issue so you can contact with them to update you regarding your matter.

    Thankyou!

Viewing 1 replies (of 1 total)

The topic ‘wp_login_failed doesn´t work when i updated elementor’ is closed to new replies.