onCategoryCreated( )


An event that is triggered when a category is created.

The onCategoryCreated() event handler runs when a category is created. The received CategoryCreated object contains information about the category that was created.

Note: Backend events don't work when previewing your site.

Method Declaration
Copy
function wixBlog_onCategoryCreated(event: CategoryCreated): void;
Method Parameters
eventCategoryCreated

Information about the category that was created.

An event that occurs when a category is created
JavaScript
// 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_onCategoryCreated(event) { const categoryId = event.metadata.entityId; const categoryLabel = event.entity.label; console.log("Category created", event); } /* * { * "metadata":{ * "id":"89705db7-dedf-4d44-ad72-de14ecf70793", * "entityId":"bcf9d83b-ba2f-44e8-ae27-3a9e2b723f54", * "eventTime":"2022-06-16T15:10:30.876Z" * }, * "entity":{ * "_id": "1ea22fce-bc3c-4b78-9422-f0f367f8628e", * "coverImage": "wix:image://v1/162e66_f6bffd1cd6144ddf87325b82fe8f42ed~mv2.jpg#originWidth=385&originHeight=245", * "description": "Posts about my summer", * "displayPosition": 2, * "label": "Summer", * "language": "en", * "postCount": 6, * "rank": 2, * "slug": "summer-slug" * "title": "", * "translationId": "973369ad-0d4b-41f5-a820-1eed7986e0de" * } * } */
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?

onCategoryDeleted( )


An event that is triggered when a category is deleted.

The onCategoryDeleted() event handler runs when a category is deleted. The received CategoryDeleted object contains event metadata.

Note: Backend events don't work when previewing your site.

Method Declaration
Copy
Method Parameters
eventCategoryDeleted

Information about the category that was deleted.

An event that occurs when a category is deleted
JavaScript
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?

onCategoryUpdated( )


An event that is triggered when a category is updated.

The onCategoryUpdated() event handler runs when a category is updated. The received CategoryUpdated object contains information about the category that was updated.

Note: Backend events don't work when previewing your site.

Method Declaration
Copy
Method Parameters
eventCategoryUpdated

Information about the category that was updated.

An event that occurs when a category is updated
JavaScript
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?

onDraftCreated( )


Developer Preview

This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.

Triggered when a draft post is created.

Method Declaration
Copy
Method Parameters
eventDraftCreated
onDraftCreated example
JavaScript
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?

onDraftDeleted( )


Developer Preview

This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.

Triggered when a draft post is deleted.

Method Declaration
Copy
Method Parameters
eventDraftDeleted
onDraftDeleted example
JavaScript
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?

onDraftUpdated( )


Developer Preview

This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.

Triggered when a draft post is updated.

Method Declaration
Copy
Method Parameters
eventDraftUpdated
onDraftUpdated example
JavaScript
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?