generate a list of catgegory child IDs for specific category associated with a parent inside the loop

Description

This code will generate a list of child IDs for specific category and can be used  in the loop.  This is useful when wanting to know IDs without haveing to look through dashboard. To use change the number  3 to the number of the parent that you would like to display the children

This code will generate a list of child IDs for specific category and can be used  in the loop.  This is useful when wanting to know IDs without haveing to look through dashboard. To use change the number  3 to the number of the parent that you would like to display the children

PHP Source Code

                        
                          <!--Get IDs child IDs start-->	
<?php
foreach((get_the_category()) as $childcat) {
if (cat_is_ancestor_of(3, $childcat)) {
echo $childcat->cat_ID;
}}
?>
<!--Get child IDs End-->                        
                        


Post Categories