Make WordPress Core

Opened 10 years ago

Closed 10 years ago

#28083 closed defect (bug) (duplicate)

exclude_tree gets overwritten in wp_list_categories

Reported by: mikehansenme's profile MikeHansenMe Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Taxonomy Keywords:
Focuses: Cc:


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 10 years ago.
wp-list-categories-exclude-tree.diff (527 bytes) - added by MikeHansenMe 10 years ago.

Download all attachments as: .zip

Change History (3)

#1 @SergeyBiryukov
10 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #12981.

Note: See TracTickets for help on using tickets.