Opened 13 years ago
Closed 13 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 |
|---|---|---|---|
| Priority: | normal | Milestone: | 3.8 |
| Component: | Taxonomy | Version: | 3.8 |
| Severity: | normal | Keywords: | has-patch |
| Cc: | Focuses: |
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)
#3
@
13 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.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Updated patch to not use a ternary operator