Opened 6 months ago
Last modified 3 months ago
#22700 new defect (bug)
Walker_Category_Checklist should sometimes set the value as the term name
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Awaiting Review |
| Component: | Administration | Version: | 3.0 |
| Severity: | normal | Keywords: | has-patch dev-feedback |
| Cc: |
Description
The Walker_Category_Checklist class has been partially adapted to work with taxonomies other than category, but it does not seem to cope with non-hierachical taxonomies.
For non-hierachical taxonomies, the HTML form elements (checkboxes, radios, dropdowns, whatever) need to set the term name as the value, not the ID… otherwise WordPress will cast the ID to a string and create a new term with that string as a name.
To see the problem:
- Use Walker_Category_Checklist to create a checkbox in a metabox on the post edit screen for a non-hierarchical taxonomy
- Add some terms to the taxonomy
- Check the box for the taxonomy and update the post
- Watch a new term appear with its name set to the ID of the term you checked
Attachments (1)
Change History (6)
simonwheatley — 6 months ago
comment:1
simonwheatley — 6 months ago
- Component changed from General to Template
- Keywords has-patch dev-feedback added
The diff adds a check to see if the taxonomy is hierarchical, and sets the value appropriately.
- Version changed from trunk to 3.0
This may be a duplicate of another ticket.
Regardless, not a regression. Pulling it back a few versions. I imagine this was done in 3.0 (a guess, admittedly).
comment:3
simonwheatley — 6 months ago
I will bow to your superior Trac knowledge! I did search for a few terms to see if the issue had previously been supported, but couldn't see anything obvious…
comment:4
simonwheatley — 3 months ago
Tested patch, still applies. The undesirable behaviour (terms being created with names equivalent to the term IDs) still occurs.
comment:5
SergeyBiryukov — 3 months ago
- Component changed from Template to Administration

Set form element value to name if taxonomy is non-hierarchical