Wordpress

Get Children Categories WordPress

By febrero 6, 2017 mayo 31st, 2020 No Comments

$idObj = get_category_by_slug($post_slug);
 $id = $idObj->term_id;
 echo $id;

   $categories =  get_categories(‘child_of=’.$id.’&hide_empty=0′);
   foreach ($categories as $c) {
    echo ‘<li>’.$c->cat_name.'</li>’;
}

Leave a Reply