0

I have created a front end post with a form and I would like to have several categories for the user to choose between. But the problem is that the dropdown category only show those categories that are in use. I need it to show all categories even if they are not in use.

The code I'm using is following:

wp_dropdown_categories(   'show_option_none=Kategori&tab_index=4&taxo. nomy=register_vote_category' );
  • Are you using wp_dropdown_categories – Pieter Goosen Jun 3 '14 at 10:02
  • Yes, I forgot to say that. I'm currently using <p><?php wp_dropdown_categories( 'show_option_none=Kategori&tab_index=4&taxonomy=register_vote_category' ); ?></p> – Adam Lundberg Jun 3 '14 at 10:06
  • You should add this info in an edit – Pieter Goosen Jun 3 '14 at 10:14
1

wp_dropdown_categories() has a parameter specially to hide or to show empty categories.

hide_empty

(boolean) (optional) Show (0/False) or hide (1/True) category with no posts.

Default: 1/True

You can simply just

 hide_empty=0

to your arguments

  • 1
    +1 This is most likely what the OP is looking for. I misread the question and thought he only wanted to show the empty categories ;-) ps You wrote wp_list_categories instead of wp_dropdown_categories. – birgire Jun 3 '14 at 10:24

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.