I fixed it myself, after a refreshed set of eyes! Plugin file class-es-mailer.php
Added an IF condition to also check for action = unsubscribe, since a couple of functions that prepare the unsubscribe link/text, sent that param value to the below function.
public static function prepare_link( $data = array() ) {
/**
* We are getting different data like action, message_id, campaign_id, contact_id, guid, email etc in $data
*/
$action = ! empty( $data['action'] ) ? $data['action'] : '';
if ( 'subscribe' === $action ) {
$action = 'optin';
}
// HERE: Fixed issue of incorrect unsubscribe link
if ( 'unsubscribe' === $action ) {
$action = 'unsubscribe';
}
$link = add_query_arg( 'es', $action, site_url( '/' ) );
$data = ig_es_encode_request_data( $data );
$link = add_query_arg( 'hash', $data, $link );
return $link;
}