#15143 closed defect (bug) (fixed)
Walker_Category::start_el() with custom taxonomy
| Reported by: | TheDeadMedic | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | 3.1 |
| Component: | Taxonomy | Version: | |
| Severity: | normal | Keywords: | |
| Cc: | Focuses: |
Description
Although wp_list_categories() supports custom taxonomies, Walker_Category::start_el() calls get_category() if the argument 'current_category' is passed, ignoring the taxonomy argument.
if ( isset($current_category) && $current_category ) $_current_category = get_category( $current_category );
Minor side effects currently include unnecessary database queries and failure to add 'current-cat-parent' class(es).
Simple fix would be to check for the taxonomy argument, and use get_term() instead;
if ( isset($current_category) && $current_category ) $_current_category = get_term( $current_category, isset($taxonomy) ? $taxonomy : 'category' );
Change History (2)
Note:
See TracTickets
for help on using tickets.
(In [15847]) Fix current-cat & current-cat-parent classes for Category listings for non-category taxonomies. General cleanup of wp_list_categories() sanity checking. Props TheDeadMedic for the initial taxonomy patch. Fixes #15143