Make WordPress Core

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#22608 closed defect (bug) (fixed)

When editing a [gallery], menu_order sorting should be used

Reported by: nacin Owned by: koopersmith
Milestone: 3.5 Priority: normal
Severity: normal Version: 3.5
Component: Media Keywords: has-patch commit dev-reviewed
Focuses: Cc:


Initially reported by devinreams via #22607. When editing a gallery created with simply the [gallery] shortcode, menu_order sorting is not used, which means they end up in a different order than they show on the frontend.

The default "orderby" for the gallery shortcode is menu_order ID, both ascending.

Attachments (1)

22608.diff (5.5 KB) - added by koopersmith 8 years ago.

Download all attachments as: .zip

Change History (9)

#1 @nacin
8 years ago

  • Owner set to koopersmith
  • Status changed from new to assigned

#2 @devinreams
8 years ago

  • Cc devin@… added

8 years ago

#3 @koopersmith
8 years ago

  • Keywords has-patch needs-testing added

Patch adds capability to sort queries by menu_order ID by adding the menuOrder property to Attachment models. Any gallery that does not specify any ids and does not specify a different orderby attribute will use menu order sorting by default. Also, the "uploaded to this post" filter is now sorted by menu order.

#4 @devinreams
8 years ago

I confirmed the following:

  1. Editing an existing gallery with a manual sort order shows those in the proper order
  2. Changing the sort order, aka updating the gallery from "Visual" view, still updates the text shortcode to include "ids" parameter
  3. The "Uploaded to this post" filter shows the proper order (the manual sort order)

#5 @ryan
8 years ago

Same here. Looks good.

#6 @nacin
8 years ago

  • Keywords commit dev-reviewed added; needs-testing removed

#7 @nacin
8 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 22882:

When editing a plain, legacy [gallery] shortcode, ensure we are sorting its contents using menu_order.

When attachments are sorted, we convert the shortcode to [gallery ids=""], as before.

props koopersmith.
fixes #22608.

#8 @nacin
8 years ago

#22758 was marked as a duplicate.

Note: See TracTickets for help on using tickets.