An event that is triggered when a post is deleted.
The onPostDeleted()
event handler runs when a post is deleted. The received PostDeleted
object contains event metadata.
Note: Backend events don't work when previewing your site.
function wixBlog_onPostDeleted(event: PostDeleted): void;
Information about the post that was deleted.
// Place this code in the events.js file
// of your site's Backend section.
// Add the file if it doesn't exist.
export function wixBlog_onPostDeleted(event) {
const deletedPostId = event.metadata.entityId;
console.log("Post deleted", event);
}
/* Full event object:
* {
* "metadata":{
* "id":"416ba1ea-b7a0-432d-9a65-a8b5b0b2208c",
* "entityId":"ecec1fb1-d21a-4bf8-9e01-c6e4f231ae67",
* "eventTime":"2022-06-16T14:21:40.065Z",
* "triggeredByAnonymizeRequest":false
* }
* }
*/
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.