Permanently deletes a draft post by the provided ID from the trash bin.
Uses the provided draftPostId
to permanently delete a draft post from the trash bin. This action is permanent and cannot be reversed.
This function requires elevated permissions and runs only on the backend and on dashboard pages.
function removeFromTrashBin(draftPostId: string): Promise<void>;
Draft post ID.
import { draftPosts } from "wix-blog-backend";
import { webMethod, Permissions } from "wix-web-module";
// Sample draftPostId value: "dd0907fa-ca4b-4fe4-ab9e-625e4733691e"
export const myRemoveFromTrashBinFunction = webMethod(
Permissions.Admin,
async (draftPostId) => {
try {
await draftPosts.removeFromTrashBin(draftPostId);
console.log("Permanently deleted the following draft post:", draftPostId);
return;
} catch (error) {
console.error(error);
// Handle the error
}
},
);
// Promise returns void
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.