WordPress to generate WP_Error Object for user login?

Solution: 

You need to hook into the authenticate wordpress hook. Then return a new WP_Error object to generate an error message and redirect back to the login page. Here is an example.

add_filter('authenticate', 'check_login_submit', 40, 3);

function check_login_submit($user, $username, $password) {
    $WP_Error = new WP_Error();
    $WP_Error->add('my_error', '<strong>Error</strong>: Something went wrong.');
    return $WP_Error;
}