1

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. I try in_category(2) function, but it always return false. I try wp_get_post_categories($post_id) but always resolve to no categories and the same with wp_get_post_terms($post_id, 'category')

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?

1

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.