Checks if a category is an ancestor of another category.
You can use either an ID or the category object for both parameters.
If you use an integer, the category will be retrieved.
$cat1int|objectrequired
$cat2int|objectrequired
function cat_is_ancestor_of( $cat1, $cat2 ) {
return term_is_ancestor_of( $cat1, $cat2, 'category' );
}
| Version | Description |
|---|---|
| 2.1.0 | Introduced. |
© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/cat_is_ancestor_of