Is there a way to make a condition for posts belonging to any sub-categories of a given parent category? Here is an example, assuming the following category structure:
- News
- FAQ
- 1) Installing
- 2) Using, etc.
- Other
if ( has_category( 'FAQ' ) ) { echo "This page has been updated for Quick Access Popup v10."; } else { echo "This page has NOT been updated for Quick Access Popup v10 yet."; }
The has_category() condition includes only posts that are in the category 'FAQ' itself, but not those in its subcategories. I know I could use an array and list every categories but this is not convenient and need to be maintained when subcategories are added, removed, etc.
The has_category() doc says nothing about parent categories (https://developer.wordpress.org/reference/functions/has_category/)
Thanks.