[wp-trac] [WordPress Trac] #31706: wp_list_categories for hierarchical taxonomy return wrong tree if orderby clause is used
WordPress Trac
noreply at wordpress.org
Fri Mar 20 11:11:54 UTC 2015
#31706: wp_list_categories for hierarchical taxonomy return wrong tree if orderby
clause is used
--------------------------+-----------------------------
Reporter: thomask | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: 4.1.1
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
My taxonomy is e.g.
{{{
-term 1
--subterm 1.1
---subterm 1.1.1
--subterm 2.1
--subterm 3.1
-term 2
-term 3
}}}
and lets say i am on the 'term 1' page and i want to return all suterms.
But when i run
{{{
$args = array(
'style' => 'list',
'title_li' => '',
'echo' => 0,
'hierarchical' => true,
'depth' => 2,
'taxonomy' => 'my_taxonomy',
'orderby' => 'count',
'order' => 'DESC',
'show_option_none' => ''
);
$args['child_of'] = $current_term->term_id;
}}}
it return only
{{{
Subterm 1.1.1
}}}
Problem is that
{{{
'orderby' => 'count',
'order' => 'DESC',
}}}
when i put it out, it works as expected
BTW IMO wp_list_categories() need some bigger rewrite - it is probably the
oldest code in WP :-). No filters, strange classes etc. especially
comparing to similar wp_nav_menu. E.g. there is no class to parent LI (and
it is often need to change e.g. for Bootstrap), nor any action or filter,
the only way are some non-trivial preg_match on the full results or
replacing the whole Walker, what is not optimal for forward and plugin
compatibility
--
Ticket URL: <https://core.trac.wordpress.org/ticket/31706>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list