[wp-trac] [WordPress Trac] #55834: wp_list_categories not working correctly since 6.0 upgrade
WordPress Trac
noreply at wordpress.org
Thu May 26 21:21:02 UTC 2022
#55834: wp_list_categories not working correctly since 6.0 upgrade
--------------------------+-------------------------
Reporter: ericcorbett2 | Owner: (none)
Type: defect (bug) | Status: closed
Priority: normal | Milestone:
Component: Taxonomy | Version:
Severity: normal | Resolution: worksforme
Keywords: | Focuses:
--------------------------+-------------------------
Comment (by ericcorbett2):
Replying to [comment:5 Quixtar]:
> I'm sorry to bother you, but what was the error in your code?
> My wp_list_categories output also is broken after 6.0 update. Even
get_terms ignoring 'child_of' parameter, despite the fact that I have set
'hide_empty' to false.
>
> Replying to [comment:3 ericcorbett2]:
> > Replying to [comment:2 ericcorbett2]:
> > > I think you misunderstand.
> > >
> > > I'm talking about invoking wp_list_categories with the &arg array.
> > >
> > > And I'm not talking posts, but pages.
> >
> > Scrub all that.
> >
> > There was a coding error on my part that must have lain dormant until
the 6.0 upgrade. I'm sorry to have wasted your time.
I'm not entirely certain to be honest, as I was using the ob_start()
function incorrectly, which complicated things.
What seems to have fixed things though was changing the 'hide_empty' => 1,
to 'hide_empty' => false.
Here's my working $args:
$atts = array(
'child_of' => $id,
'current_category' => 0,
'depth' => 0,
'echo' => 0,
'exclude' => '',
'exclude_tree' => '',
'feed' => '',
'feed_image' => '',
'feed_type' => '',
'hide_empty' => false,
'hide_title_if_empty' => false,
'hierarchical' => true,
'order' => 'ASC',
'orderby' => 'name',
'separator' => '',
'show_count' => 0,
'show_option_all' => '',
'show_option_none' => __( 'No categories' ),
'style' => 'list',
'taxonomy' => 'category',
'title_li' => '',
'use_desc_for_title' => 1,
);
Hope that helps.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/55834#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list