i need to get only sub category ID. i already get sub category id but it coming with main category id too
bellow is code
<?php while ( have_posts() ) : the_post(); ?>
<option value=".<?php
foreach((get_the_category()) as $category) {
echo $category->cat_ID . ' '. $category->cat_name ;
}
?>">
<?php
foreach((get_the_category()) as $category) {
echo $category->cat_name . ' ';
}
?>
</option>
<?php endwhile;
?>
after code my rendered code is like bellow
<select id="filter-select">
<option value="*" selected="selected">all</option>
<option value=".15 8 ">Magdalena Venta </option>
<option value=".15 8 ">Bo. de la Magdalena</option>
<option value=".16 8 ">Juan Venta</option>
<option value=".17 8 ">Club de G</option>
<option value=".21 8 ">Fraccionamiento Viñedos Venta</option>
</select>
after value all is sub category id like 15, 16, 17,21 but 8 is is main category ID. i don’t want this 8 coming.
so mainly i want to get like this <option value="child category ID ">Child Category Name </option>
i am trying still. if i get can get any solution it will post here