onPostLiked( )


An event that is triggered when a post is liked.

The onPostLiked() event handler runs when a post is liked. The received PostLikedEvent object contains data about the liked post including the postId, and the memberId or anonymousVisitorId.

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

Method Declaration
Copy
function wixBlog_onPostLiked(event: PostLikedEvent): void;
Method Parameters
eventPostLikedEvent

Information about the post that was liked.

An event that occurs when a blog post is liked
JavaScript
export function wixBlog_onPostLiked(event) { const postIdLiked = event.metadata.entityId; const memberId = event.data.memberId; console.log("Post liked", event); } /* Full event object: * { * "metadata":{ * "id": "e7ae2019-7d68-4342-8fa0-b28e20e8ec80", * "entityId": "e65bd5d9-36ca-4388-8064-3d785d0f5460", * "eventTime":"2022-06-16T15:22:49.242Z", * "triggeredByAnonymizeRequest":false * }, * "data":{ * "postId":"e65bd5d9-36ca-4388-8064-3d785d0f5460", * "memberId": "33d02592-dd28-4eff-9b8e-4c3bb9c737dd" * } * } */
Errors

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

Did this help?