Site icon Hip-Hop Website Design and Development

Hooking into ‘authenticate’ causes login to submit on web page load

I added a filter for the ‘autnenticate’ hook to use some extra login verification, but when I modify the filter precedence to twenty, the filter appears to be firing on wp-login web page load even when the shape isn’t submitted.

add_filter( 'authenticate', 'custom_login', 20, 3 );

Any time, the login web page is loaded, this message is all the time displayed though nothing is submitted:

ERROR: Empty username or password.

As that is the primary verify within the ‘custom_login’ operate:

        if($username == '' || $password == '') {
    
            $error = new WP_Error();

            $error->add('empty_username', __('<robust>ERROR</robust>: Empty username or password.'));
        
            return $error;
    }

I’m making an attempt to grasp why it runs even when the shape isn’t submitted on wp-login web page load.