Make WordPress Core

Opened 12 years ago

Closed 12 years ago

#28083 closed defect (bug) (duplicate)

exclude_tree gets overwritten in wp_list_categories

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

Description

When using the function wp_list_categories and passing 'exclude_tree' the value gets overwritten by 'exclude' which by default is . This is because of the following lines in the function:

if ( true == $r['hierarchical'] ) {
	$r['exclude_tree'] = $r['exclude'];
	$r['exclude'] = '';
}

Hierarchical is true by default so unless you set that to false the code gets ran. Unless you pass a value to 'exclude' then the default overwrites 'exclude_tree' which may have been set.

I have included a patch and some unit tests for the wp_list_categories function.

Attachments (2)

unit-tests-wp-list-categories.diff​ (13.6 KB ) - added by MikeHansenMe 12 years ago.
wp-list-categories-exclude-tree.diff​ (527 bytes ) - added by MikeHansenMe 12 years ago.

Download all attachments as: .zip

Change History (3)

#1 @SergeyBiryukov
12 years ago

  • Milestone Awaiting Review
  • Resolution → duplicate
  • Status new → closed

Duplicate of #12981.

Note: See TracTickets for help on using tickets.