Opened 12 months ago
Closed 12 months ago
#21180 closed defect (bug) (duplicate)
Customize feature settings/controls sorting issue
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Appearance | Version: | 3.4.1 |
| Severity: | major | Keywords: | close |
| Cc: |
Description
If you have up to 5 settings the sorting is fine. As soon as you go over 5 the sorting goes crazy.
If there are 6 then the 1st and 2nd switch places, if you have 7 then 6th and 7th switch places, if you have 8 then the 1st and 2nd (the new ones, after the first switch) switch places.
So with 8 controls the sorting becomes: 3, 2, 1, 4, 5, 7, 6, 8
After digging around for a while, i found where this sorting mess up is coming from.
In class-wp-customize-manager.php on line 673...
usort( $section->controls, array( $this, '_cmp_priority' ) );
...it seems the controls are being sorted by priority, but they don't have priorities (from what i know). By removing this line the order is restored, but it's reversed (the controls are reversed on line 652), so adding this line...
$section->controls = array_reverse( $section->controls);
...the order is reversed again (becomes original) and the issue completely goes away.
I'm sure there's a reason for the sorting by priority so probably everything i just said is useless but at least you know there's a bug.
Change History (4)
comment:1
scribu
— 12 months ago
- Component changed from General to Appearance
- Milestone changed from Awaiting Review to 3.4.2
comment:3
in reply to:
↑ 2
wpcanyon
— 12 months ago
Replying to ocean90:
I think this is related to #20733.
That one is regarding sections with the same priority, this is about controls ordered by priority which they don't have (at least not user specified, maybe it's added automatically, but couldn't find it) which brakes the sorting.
comment:4
SergeyBiryukov
— 12 months ago
- Keywords needs-patch removed
- Milestone 3.4.2 deleted
- Resolution set to duplicate
- Status changed from new to closed
Sounds like a duplicate. Let's solve this in #20733 for both sections and controls.
I think this is related to #20733.