$prepared_comment =
apply_filters( 'rest_pre_insert_comment',
$prepared_comment,
$request );
if ( is_wp_error( $prepared_comment ) ) { return $prepared_comment;
} $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 );
}