public function update_item( $request ) { $comment =
$this->
get_comment( $request['id'
] );
if ( is_wp_error( $comment ) ) { return $comment;
} $id =
$comment->comment_ID;
if ( isset( $request['type'
] ) &&
get_comment_type( $id ) !==
$request['type'
] ) { return new WP_Error( 'rest_comment_invalid_type',
__( 'Sorry, you are not allowed to change the comment type.'
),
array
( 'status' => 404
) );
} $prepared_args =
$this->
prepare_item_for_database( $request );
if ( is_wp_error( $prepared_args ) ) { return $prepared_args;
}