Make WordPress Core

Opened 12 years ago

Closed 12 years ago

#21180 closed defect (bug) (duplicate)

Customize feature settings/controls sorting issue

Reported by: wpcanyon's profile wpcanyon Owned by:
Milestone: Priority: normal
Severity: major Version: 3.4.1
Component: Customize Keywords: close
Focuses: Cc:


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' ) ); 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)

#1 @scribu
12 years ago

  • Component changed from General to Appearance
  • Milestone changed from Awaiting Review to 3.4.2

#2 follow-up: @ocean90
12 years ago

  • Keywords close added

I think this is related to #20733.

#3 in reply to: ↑ 2 @wpcanyon
12 years 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.


Actually giving a priority to a control seems to be working (could have sworn i tried that already).

So it's related to #20733, the default priority for the controls is probably not incremented so they all have the same priority and the same issue as with the section occurs.

Last edited 12 years ago by wpcanyon (previous) (diff)

#4 @SergeyBiryukov
12 years 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.

Note: See TracTickets for help on using tickets.