Skip to content

Empty Categories Not Shown in Pulldown #11

@FeXd

Description

@FeXd

I made a new category for a post, but it wasn't visible. I did some googling and a suggestion was that it may be hidden because it has no posts in it yet. That appears to be true.

Current dropdown code:

<?php wp_dropdown_categories(array('name' => 'category', 'orderby' => 'name', 'taxonomy' => 'category', 'selected' => 1)); ?>

Suggested update:

<?php wp_dropdown_categories(array(
  'name' => 'category',
  'orderby' => 'name',
  'taxonomy' => 'category',
  'hide_empty' => 0,
  'selected' => 1
)); ?>

Note the addition of hide_empty

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions