PluginProbe
Force Refresh / 3.2.1
Force Refresh v3.2.1
3.2.1 3.2.0 3.1.2 3.1.1 3.1.0 trunk 1.0.0 1.1.0 1.1.1 1.1.2 1.2.0 2.0.0 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.10.0 2.10.1 2.10.2 2.11.0 2.11.1 2.12.0 All 54 releases
← All changes | includes/api/classes/class-api-handler.php +6 -7 2.10.03.2.1 View file →
@@ -73,17 +73,16 @@
73 73 * @param string $message The plaintext message displayed to the user
74 74 * that explains the status.
75 75 * @param array $data An array of data to sent as the response.
76 76 *
77 - * @return void
77 + * @return \WP_REST_Response
78 78 */
79 - public function return_api_response( int $status_code, string $message, $data = array() ): void {
80 - status_header( $status_code );
81 - print wp_json_encode(
79 + public function return_api_response( int $status_code, string $message, $data = array() ): \WP_REST_Response {
80 + return new \WP_REST_Response(
82 81 array(
83 - 'code' => $status_code,
82 + 'data' => $data,
84 83 'message' => $message,
85 - 'data' => $data,
86 - )
84 + ),
85 + $status_code
87 86 );
88 87 }
89 88 }