Make WordPress Core

Opened 18 years ago

Closed 17 years ago

Last modified 17 years ago

#7701 closed defect (bug) (duplicate)

Don't include current category or childeren in "Category Parent" dropdown

Reported by: mtekk Owned by:
Priority: normal Milestone:
Component: Administration Version: 2.6.1
Severity: minor Keywords: needs-patch
Cc: Focuses:

Description

In #3278 it was reported that categories should not be allowed to be their own parent. Even though this was fixed in [4490], in 2.6.1 the current category and its children still appear in the "Category Parent" dropdown list. They probably should be removed as they are not valid options (they end up being ignored if selected). I also tested this in [8841] and it still has this problem.

Attachments (1)

7701-edit-category-form.php.diff​ (1017 bytes ) - added by mtekk 17 years ago.
A better version, still not 100% working

Download all attachments as: .zip

Change History (9)

#1 @ryan
17 years ago

  • Milestone 2.8 → 2.7
  • Resolution → fixed
  • Status new → closed

Fixed in 2.7, I believe.

#2 @mtekk
17 years ago

  • Keywords needs-patch added; category parent removed
  • Milestone 2.7 → 2.8
  • Resolution fixed
  • Status closed → reopened

It's not fixed in r11063, the dropdown still includes child categories of a parent (along with itself). It can't actually set to those invalid values, but it should be removed from the dropdown. I'll look into a solution.

#3 follow-up: @mtekk
17 years ago

Ok, we're using wp_dropdown_categories for the dropdown, but there is no exclude being used at the moment to exclude the current category. That's the first problem, and it's easily fixable, see my patch 7701-edit-category-form.php.diff. The second part is we probably should have wp_dropdown_categories exclude the children of categories that have been excluded.

@mtekk
17 years ago

A better version, still not 100% working

#4 in reply to: ↑ 3 @mtekk
17 years ago

Disregard my last comment, I found the newish exclude_tree option (codex does not have it documented yet). The other thing is, if hierarchical is set to true, exclude should work the same as exclude_tree, however the code seems to not work (this is in the function wp_list_categories). Now, the only bug in my updated patch is that the hide_empty setting is over riding the exclude_tree option (the empty children of an excluded category still end up in the list, a problem is in get_terms I believe).

#5 @janeforshort
17 years ago

  • Milestone 2.8 → Future Release

Punting due to feature freeze. Reconsider with next release.

#6 @Denis-de-Bernardy
17 years ago

  • Milestone Future Release → 2.9

#7 @scribu
17 years ago

  • Resolution → duplicate
  • Status reopened → closed

Marking this as duplicate of #10644

Please reopen that ticket if necessary.

#8 @scribu
17 years ago

  • Milestone 2.9
Note: See TracTickets for help on using tickets.