Opened 11 years ago
Closed 11 years ago
#25852 closed defect (bug) (fixed)
Saving term broken. If no term parent is set - sets to term ID 1.
Reported by: | mattheu | Owned by: | SergeyBiryukov |
---|---|---|---|
Milestone: | 3.8 | Priority: | normal |
Severity: | normal | Version: | 3.8 |
Component: | Taxonomy | Keywords: | has-patch |
Focuses: | Cc: |
Description
This was introduced by the fix for ticket #17646
When saving a term with no parent selected - the parent is saved as term 1
. It should be set to 0
. For non-category terms - this causes them to dissapear from the admin.
From category-template.php line 346 - The term parent select field uses -1
for none
- and this is now cast to 1
by the sanitize_term_field
function - which saves the term parent as 1.
I've added a patch that sets any negative values to 0.
Attachments (3)
Change History (7)
#1
@
11 years ago
- Component changed from General to Taxonomy
- Milestone changed from Awaiting Review to 3.8
- Version set to trunk
#3
@
11 years ago
25852-2.diff would not work as expected, since $value
is already changed to 1 in line 1714. The check should also be inside the in_array()
condition, not after it.
25852.3.diff reverts that part of [26010] and adds a basic unit test.
Note: See
TracTickets for help on using
tickets.
Updated patch to not use a ternary operator