Make WordPress Core

Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#15143 closed defect (bug) (fixed)

Walker_Category::start_el() with custom taxonomy

Reported by: thedeadmedic's profile TheDeadMedic Owned by:
Milestone: 3.1 Priority: normal
Severity: normal Version:
Component: Taxonomy Keywords:
Focuses: Cc:


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)

#1 @dd32
13 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(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

#2 @nacin
13 years ago

  • Milestone changed from Awaiting Review to 3.1
Note: See TracTickets for help on using tickets.