WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 5 years ago

Last modified 5 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:

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

Download all attachments as: .zip

Change History (9)

comment:1 ryan5 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.

comment:2 mtekk5 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.

comment:3 follow-up: mtekk5 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.

mtekk5 years ago

A better version, still not 100% working

comment:4 in reply to: ↑ 3 mtekk5 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).

comment:5 janeforshort5 years ago

  • Milestone changed from 2.8 to Future Release

Punting due to feature freeze. Reconsider with next release.

comment:6 Denis-de-Bernardy5 years ago

  • Milestone changed from Future Release to 2.9

comment:7 scribu5 years ago

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

Marking this as duplicate of #10644

Please reopen that ticket if necessary.

comment:8 scribu5 years ago

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