WordPress.org

Make WordPress Core

Opened 11 years ago

Closed 10 years ago

#9999 closed defect (bug) (invalid)

Beta 2.8.2 - wp_list_categories buggy hierarchy

Reported by: eliZZZa Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Template Keywords: needs-patch
Focuses: Cc:
PR Number:

Description

I try to exclude some categories and show the rest hierarchical.
Following problems occur:

With child_of it does show the desired cats but without hierarchy, even if I add hierarchical=1

With include it does not show children, even if I add depth=0

With exclude it behaves mainly like the former exclude_tree but leaves a few subcats for no obvious reason (with their parents excluded).

Any idea, how I could force a tree view?

I am testing on http://team.eliZZZa.net/
In the right sidebar you see two occurences of wp_list_categories, coded like this:
<?php wp_list_categories("exclude=1,2,3,5,6,7,10,11,13,14,15,16,17,19,20,26,27,30,31,32,33,84,85,87,88,103,104,105,111,112,113,114,115,116,117,118,119&title_li=&hierarchical=1&hide_empty=0&show_count=1&feed=rss&feed_image=http://team.elizzza.net/wp-content/themes/teameli/images/rss.gif&current_category=1"); ?>
and
<?php wp_list_categories("exclude=1,2,3,5,6,7,10,11,13,14,15,16,17,19,20,26,27,30,31,32,33,84,85,87,88,103,104,105,107,109,110&title_li=&hierarchical=1&hide_empty=0&show_count=1&feed=rss&feed_image=http://team.elizzza.net/wp-content/themes/teameli/images/rss.gif&current_category=1"); ?>
respectively...

Kind regards from Austria

Change History (3)

#1 @Denis-de-Bernardy
11 years ago

  • Component changed from General to Template
  • Keywords needs-patch added
  • Milestone changed from 2.8 to Future Release

#2 in reply to: ↑ description @filosofo
10 years ago

Hello eliZZZa,

Replying to eliZZZa:

With child_of it does show the desired cats but without hierarchy

Can you explain what you're expecting, and how the results differ? Passing a category ID as the "child_of" parameter does produce nested lists, in my tests.

With include it does not show children, even if I add depth=0

"include" is meant to specify exactly which category ids you want to show. I don't think it makes sense to expect it to include the descendants of those specified category ids. Perhaps we need something like "include_tree" to do that, or maybe we could expand "child_of" to accept multiple IDs.

With exclude it behaves mainly like the former exclude_tree but leaves a few subcats for no obvious reason (with their parents excluded).

Again, since "exclude", like "include" is meant to specify exactly which IDs to exclude, it doesn't make sense to expect it to exclude those IDs' children. That's what "exclude_tree" is for.

#3 @Denis-de-Bernardy
10 years ago

  • Milestone Future Release deleted
  • Resolution set to invalid
  • Status changed from new to closed

closing this as invalid:

<sivel> i'm thinking so...looking at the discussion on wp-testers it seems as though the codex is wrong so everyone thinks the function is also

<sivel> because they believe that the codex is right

Note: See TracTickets for help on using tickets.