1

I know how to get all categories with get_categories and name custom taxonomy name, but wordpress only shows those categories those are assigned to a post. Those which are created, but not assigned, will not show up with any of these methods.

So is there any function that shows all categories that created + assigned and not assigned.

I am working in a admin panel to show all categories in a drop down list in a custom post type.

3

I know how to get all categories with get_categories

I think you've missed some of the arguments in get_categories. By default, empty categories (categories without posts) are hidden

'hide_empty'               => 1,

To get categories without posts, simply set hide_empty to 0

'hide_empty'               => 0,

Here is an example

$categories = get_categories( 'hide_empty=0' );
  • Yeah that worked thanks. I overlooked it silly of me. – Shah Jul 18 '14 at 12:27
  • No problem, just glad it fixed your problem :-) – Pieter Goosen Jul 18 '14 at 12:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.