Search.../

deleteDraftPost( )

Developer Preview

Moves a draft post with the provided ID to the trash bin. A published post can also be deleted by its provided draftPostId.

Description

The optional permanent field enables you to delete a post permanently, bypassing the trash bin. When a draft post is deleted this way, it can't be restored.

Admin Method

This function requires elevated permissions to run. This function is not universal and runs only on the backend.

Syntax

function deleteDraftPost(draftPostId: string, options: DeleteDraftPostOptions): Promise<void>

deleteDraftPost Parameters

NAME
TYPE
DESCRIPTION
draftPostId
string

Draft post ID.

options
Optional
DeleteDraftPostOptions

Options for deleting a draft post.

Returns

Return Type:

Promise<
void
>

Was this helpful?

deleteDraftPost example

Copy Code
1import { draftPosts } from 'wix-blog-backend';
2
3 async function deleteDraftPost(draftPostId, options) {
4 try {
5 const result = await draftPosts.deleteDraftPost(draftPostId, options);
6
7 return result;
8 } catch (error) {
9 console.error(error);
10 // Handle the error
11 }
12 }
13