WP_REST_Comments_Controller::get_item()
Retrieves a comment.
Method of the class: WP_REST_Comments_Controller{}
No Hooks.
Return
WP_REST_Response|WP_Error
. Response object on success, or error object on failure.
Usage
$WP_REST_Comments_Controller = new WP_REST_Comments_Controller(); $WP_REST_Comments_Controller->get_item( $request );
- $request(WP_REST_Request) (required)
- Full details about the request.
Changelog
Since 4.7.0 | Introduced. |
WP_REST_Comments_Controller::get_item() WP REST Comments Controller::get item code WP 6.6.1
public function get_item( $request ) { $comment = $this->get_comment( $request['id'] ); if ( is_wp_error( $comment ) ) { return $comment; } $data = $this->prepare_item_for_response( $comment, $request ); $response = rest_ensure_response( $data ); return $response; }