WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 3 years ago

Last modified 3 years ago

#15143 closed defect (bug) (fixed)

Walker_Category::start_el() with custom taxonomy

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

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)

comment:1 dd323 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

comment:2 nacin3 years ago

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