Plugin Contributor
csonnek
(@csonnek)
Happiness Rocketeer 🚀
Hi there:
We do have a filter for that – you can find the filter and an example on how to implement that on this page:
https://developer.jetpack.com/hooks/jetpack_widget_get_top_posts/
In the example, you would need to find the post IDs of all the posts in the category that you want to exclude and use the filter to filter them out. You could also modify the example to filter out by category slug instead of post ID. You can experiment with the best way to implement that filter to work how you’d like.
I hope that helps!
You can follow the example at the bottom of the page Carolyn mentionned earlier.
There, you can use the in_category() function to check if each post ID belongs to a specific category, and then unset it if it does:
https://developer.wordpress.org/reference/functions/in_category/
I hope this helps.