Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

get_categories() only returns categories in use

$args = array(
"type"      => "post",      
"orderby"   => "name",
"order"     => "ASC");

$types = get_categories($args);

When this is executed. $types only contains "Uncategorized" since it is used as the default to my posts. There are other categories available, but they are not returned unless I have a post that uses them. How can I return all possible categories and not just the ones that are in use?

like image 219
John Avatar asked Jun 22 '12 11:06

John


1 Answers

<?php $args = array("hide_empty" => 0,
                    "type"      => "post",      
                    "orderby"   => "name",
                    "order"     => "ASC" );
      $types = get_categories($args);
?>
like image 54
coolguy Avatar answered Sep 21 '22 01:09

coolguy