Created
April 7, 2016 21:45
-
-
Save UVLabs/89c4247882e8a7634edf76612e03f642 to your computer and use it in GitHub Desktop.
Get all categories on site, whether custom post type or w/e. change parent array to '', to get all categories, including children.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$args = array( | |
'type' => 'post', | |
'child_of' => 0, | |
'parent' => 0, | |
'orderby' => 'name', | |
'order' => 'ASC', | |
'hide_empty' => 0, | |
'hierarchical' => 1, | |
'exclude' => '', | |
'include' => '', | |
'number' => '', | |
'taxonomy' => 'course', | |
'pad_counts' => false ); | |
$categories = get_categories( $args ); | |
foreach ($categories as $cat2) { | |
echo $cat2->name.'</br>'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment