$id =
$template->wp_id;
$force =
(bool) $request['force'
];
$request->
set_param( 'context', 'edit'
);
// If we're forcing, then delete permanently.
if ( $force ) { $previous =
$this->
prepare_item_for_response( $template,
$request );
$result =
wp_delete_post( $id, true
);
$response =
new WP_REST_Response();
$response->
set_data( array
( 'deleted' => true,
'previous' =>
$previous->
get_data(),
) );
} else { // Otherwise, only trash if we haven't already.
if ( 'trash' ===
$template->status
) { return new WP_Error( 'rest_template_already_trashed',
__( 'The template has already been deleted.'
),