$comment_id =
wp_insert_comment( wp_filter_comment( wp_slash( (array) $prepared_comment ) ) );
if ( !
$comment_id ) { return new WP_Error( 'rest_comment_failed_create',
__( 'Creating comment failed.'
),
array
( 'status' => 500
) );
} if ( isset( $request['status'
] ) ) { $this->
handle_status_param( $request['status'
],
$comment_id );
} $comment =
get_comment( $comment_id );
/**
* Fires after a comment is created or updated via the REST API.
*
* @since 4.7.0
*
* @param WP_Comment $comment Inserted or updated comment object.
* @param WP_REST_Request $request Request object.
* @param bool $creating True when creating a comment, false
* when updating.
*/