get_categories for Custom Post Type
18,034
get_categories()
does not accept post_type
as an argument, use taxonomy
instead and refer to the taxonomy by the name you gave it when registering it. Here is a link to the codex which can explain it in more detail - http://codex.wordpress.org/Function_Reference/get_categories.
Author by
ioni
Updated on June 06, 2022Comments
-
ioni almost 2 years
I have a Custom Post Type, 'ioni_codex' I am using built-in Wordpress category as taxonomy
I want to list all categories used by 'ioni_codex'.
I assume that this code will do the trick:
$myargs = array ( 'type' => 'ioni_codex' ); $categories = get_categories( $myargs );
However instead I see the list of all categories not the categories assigned to by 'ioni_codex'.
What Am I doing wrong?