has_term not working

You mention in a previous comment that you are defining $post directly before the conditional statements. Since this is the case you need to pass the $post object to both these functions to get desired results otherwise WordPress will attempt to use the global $post object which isn’t what you’ve defined and thus throwing errors … Read more

What’s the difference between “parent” and “category_parent” in a WP_Term object?

The properties prefixed with category_ or cat_ are there for backwards compatibility. Taxonomies and terms were introduced in WordPress 2.3 (11 years ago) and categories were converted into a taxonomy at that time. Prior to this categories had their own properties (the ones with the aforementioned prefixes). For backwards compatibility, the _make_cat_compat() function is used … Read more