I've used a query that will query if the post in a specific category, to show a list of subcategories it belongs to.
The problem I'm having is I also want to exclude a specific subcategory from the output.
The current code is:
<?php
foreach((get_the_category()) as $childcat) {
if (cat_is_ancestor_of(81, $childcat)) {
echo '<li><a href="'.get_category_link($childcat->cat_ID).'">';
echo $childcat->cat_name . '</a></li> ';
}}
?>
Is there something I can add to this to exclude a category ID as well?
if
statement?if ( $childcat->cat_ID !== 1234 )
where1234
is the ID of the category to be excluded? I'm not seeing the need for any special WP functions