Skip to content

Commit ee8497c

Browse files
committed
return json data instead of echoing, for AJAX callbacks and reindexing/settings pushing.
1 parent 4a8f85a commit ee8497c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

includes/admin/class-algolia-admin.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,9 @@ public function re_index() {
272272

273273
wp_send_json( $response );
274274
} catch ( Exception $exception ) {
275-
echo esc_html( $exception->getMessage() );
275+
wp_send_json( [
276+
'responseText' => $exception->getMessage()
277+
] );
276278
throw $exception;
277279
}
278280
}
@@ -307,7 +309,9 @@ public function push_settings() {
307309
);
308310
wp_send_json( $response );
309311
} catch ( Exception $exception ) {
310-
echo esc_html( $exception->getMessage() );
312+
wp_send_json( [
313+
'responseText' => $exception->getMessage()
314+
] );
311315
throw $exception;
312316
}
313317
}

0 commit comments

Comments
 (0)