if ( in_array( 'author_avatar_urls',
$fields, true
) ) { $data['author_avatar_urls'
] =
rest_get_avatar_urls( $comment );
} if ( in_array( 'meta',
$fields, true
) ) { $data['meta'
] =
$this->meta->
get_value( $comment->comment_ID,
$request );
} $context = !
empty( $request['context'
] ) ?
$request['context'
] : 'view';
$data =
$this->
add_additional_fields_to_object( $data,
$request );
$data =
$this->
filter_response_by_context( $data,
$context );
// Wrap the data in a response object.
$response =
rest_ensure_response( $data );
if ( rest_is_field_included( '_links',
$fields ) ||
rest_is_field_included( '_embedded',
$fields ) ) { $response->
add_links( $this->
prepare_links( $comment ) );
} /**
* Filters a comment returned from the REST API.
*
* Allows modification of the comment right before it is returned.
*
* @since 4.7.0
*
* @param WP_REST_Response $response The response object.
* @param WP_Comment $comment The original comment object.
* @param WP_REST_Request $request Request used to generate the response.
*/