Skip to content

Commit

Permalink
syntax improvements.
Browse files Browse the repository at this point in the history
  • Loading branch information
iamdharmesh committed Oct 29, 2024
1 parent 019bb5f commit b767153
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/mailchimp/mailchimp.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,9 @@ public function post( $endpoint, $body, $method = 'POST' ) {
$field_name = $merge['name'];
}
}
$message = $body['errors'][0]['message'];
if ( ! empty ( $field_name ) ) {
$message = $field_name . ': ' . $body['errors'][0]['message'];
}
$message = $body['errors'][0]['message'] ?? esc_html__( 'Something went wrong, Please try again later.', 'mailchimp' );
$message = ( ! empty( $field_name ) ) ? $field_name . ': ' . $message : $message;

return new WP_Error( 'mc-subscribe-error-api', $message );
}
}
Expand Down

0 comments on commit b767153

Please sign in to comment.