Support » Fixing WordPress » wp_list_categories won't hide empty taxonomy terms

  • I’m using wp_list_categories to display a list of custom taxonomy terms. I would expect terms that are not associated with a published post to be hidden. That isn’t the case. I’ve tried setting hide_empty=1 (even thought that’s the default) with no luck.

    Looking for a workaround…

Viewing 1 replies (of 1 total)
  • Yes, I’m looking for a workaround on a similar scenario. I use the code below to call the list, which only shows the taxonomy terms that are active…the only problem is that the list shows a taxonomy term when it is tied to a draft. How can I show just the terms that are tied to published posts?

    $taxonomy     = 'people';
    $orderby      = 'name';
    $show_count   = 1;      // 1 for yes, 0 for no
    $pad_counts   = 0;      // 1 for yes, 0 for no
    $hierarchical = 1;      // 1 for yes, 0 for no
    $title        = '';
    $args = array(
      'taxonomy'     => $taxonomy,
      'orderby'      => $orderby,
      'show_count'   => $show_count,
      'pad_counts'   => $pad_counts,
      'hierarchical' => $hierarchical,
      'title_li'     => $title
    <?php wp_list_categories( $args ); ?>
Viewing 1 replies (of 1 total)
  • The topic ‘wp_list_categories won't hide empty taxonomy terms’ is closed to new replies.