'GET', 'callback' => 'build_revue_authors', 'permission_callback' => '__return_true', )); }); // ################ NEWS ################ function build_revue_authors($request) { $revueID = esc_html($request->get_param('revue-id')); ob_start(); get_template_part('template-parts/authors/revue-authors-list', null, array( 'revueID' => $revueID, )); $html_template = ob_get_clean(); $response_data = array( 'html_template' => $html_template, 'message' => 'Hello World', ); $response = new WP_REST_Response($response_data); $response->set_status(200); return $response; }