Make WordPress Core

Opened 12 years ago

Closed 11 years ago

Last modified 11 years ago

#7701 closed defect (bug) (duplicate)

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

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


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 11 years ago.
A better version, still not 100% working

Download all attachments as: .zip

Change History (9)

#1 @ryan
11 years ago

  • Milestone changed from 2.8 to 2.7
  • Resolution set to fixed
  • Status changed from new to closed

Fixed in 2.7, I believe.

#2 @mtekk
11 years ago

  • Keywords needs-patch added; category parent removed
  • Milestone changed from 2.7 to 2.8
  • Resolution fixed deleted
  • Status changed from closed to 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
11 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.

11 years ago

A better version, still not 100% working

#4 in reply to: ↑ 3 @mtekk
11 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
11 years ago

  • Milestone changed from 2.8 to Future Release

Punting due to feature freeze. Reconsider with next release.

#6 @Denis-de-Bernardy
11 years ago

  • Milestone changed from Future Release to 2.9

#7 @scribu
11 years ago

  • Resolution set to duplicate
  • Status changed from reopened to closed

Marking this as duplicate of #10644

Please reopen that ticket if necessary.

#8 @scribu
11 years ago

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