I am trying to retrieve categories from the category
taxonomy of the custom post
type
By the below codes :
$categories = get_categories(array(
'type' => 'ad_listing',
'child_of' => 0,
'parent' => '',
'orderby' => 'name',
'order' => 'ASC',
'hide_empty' => 1,
'hierarchical'=> 1,
'exclude' => '',
'include' => '',
'number' => '',
'taxonomy' => 'ad_cat',
'pad_counts' => false
));
echo"<pre>";
print_r($categories);
echo"</pre>";
But it is not showing nothing in category though there are 3 categories.
i think i am doing something wrong 🙁
It will work,
Can you check any post assing in any category or not.If any post not assing any category then no category show.
If you want to show all category without post assign to category. Change hide_empty=>false See below code
Here is the code work for me.
Use
<?php get_taxonomies( $args, $output, $operator ) ?>
get_categories might be forpost_type='post'