Search.../

onCategoryUpdated( )

An event that is triggered when a category is updated.

Description

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.

Syntax

function wixBlog_onCategoryUpdated(event: CategoryUpdated): void

onCategoryUpdated Parameters

NAME
TYPE
DESCRIPTION
event
Optional
CategoryUpdated

Information about the category that was updated.

Returns

This function does not return anything.

Return Type:

void

Was this helpful?

An event that occurs when a category is updated

Copy Code
1// Place this code in the events.js file
2// of your site's Backend section.
3// Add the file if it doesn't exist.
4
5export function wixBlog_onCategoryUpdated(event) {
6 const categoryId = event.metadata.entityId;
7 const categoryLabel = event.entity.label;
8 console.log('Category updated', event);
9}
10
11/*
12 * {
13 * "metadata":{
14 * "id":"26b06cb0-d28b-43d3-9c34-a637c217e79a",
15 * "entityId":"bcf9d83b-ba2f-44e8-ae27-3a9e2b723f54",
16 * "eventTime":"2022-06-16T15:12:54.599Z",
17 * "triggeredByAnonymizeRequest":false
18 * },
19 * "entity":{
20 * "_id": "1ea22fce-bc3c-4b78-9422-f0f367f8628e",
21 * "coverImage": "wix:image://v1/162e66_f6bffd1cd6144ddf87325b82fe8f42ed~mv2.jpg#originWidth=385&originHeight=245",
22 * "description": "Posts about my winter",
23 * "displayPosition": 2,
24 * "label": "winter",
25 * "language": "en",
26 * "postCount": 6,
27 * "rank": 2,
28 * "slug": "winter-slug"
29 * "title": "",
30 * "translationId": "973369ad-0d4b-41f5-a820-1eed7986e0de"
31 * }
32 * }
33 */
34