php - wordpress get_categories function not working -


i trying retrieve categories category taxonomy of custom post type 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 not showing nothing in category though there 3 categories. think doing wrong :(

can check post assing in category or not.if post not assing category no category show.

if want show category without post assign category. change hide_empty=>false see below code

<?php $categories = get_categories( array(             'type'        => 'post',             'child_of'    => 0,             'parent'      => '',             'orderby'     => 'name',             'order'       => 'asc',             'hide_empty'  => false,             'hierarchical'=> 1,             'exclude'     => '',             'include'     => '',             'number'      => '',             'taxonomy'    => 'category',             'pad_counts'  => false          ) );     echo"<pre>";     print_r($categories);     echo"</pre>"; ?> 

Comments

Popular posts from this blog

SVG stroke-linecap doesn't work for circles in Firefox? -

routes - Laravel 4 Wildcard Routing to Different Controllers -

cross browser - XSLT namespace-alias Not Working in Firefox or Chrome -