WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#28083 closed defect (bug) (duplicate)

exclude_tree gets overwritten in wp_list_categories

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

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

Download all attachments as: .zip

Change History (3)

#1 @SergeyBiryukov
6 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.