Send push when new post is published in a certain category
I’m trying to develop a plugin which send a push notification to an app users, when a new post is published on a certain category.
I’m trying with the hook
save_post, but when the hook is fired, the post has no categories.
in_category(2) function, but it always return false.
wp_get_post_categories($post_id) but always resolve to no categories and the same with
I dont know if
save_post hook is the correct, I think it’s fired before the categories are asociated to the post.
How I know if the post is published in a certain category?