Make WordPress Core

Opened 10 years ago

Closed 10 years ago

#24868 closed defect (bug) (fixed)

Gallery shortcode removes orderby

Reported by: markoheijnen's profile markoheijnen Owned by: nacin's profile nacin
Milestone: 3.7 Priority: normal
Severity: normal Version: 3.5
Component: Media Keywords: has-patch commit
Focuses: Cc:


WordPress doesn't support it anymore but when old shortcode still have the orderby value in the shortcode it gets removed when updating the gallery. It's still used in the shortcode and people still can add it manually when using the text editor

Attachments (1)

24868.diff (1.0 KB) - added by nofearinc 10 years ago.

Download all attachments as: .zip

Change History (9)

10 years ago

#1 @nofearinc
10 years ago

This is not exactly a great fix, but I wasn't able to find a better solution.

The problem was that all orderby actions are oriented around the Random Order checkbox in the gallery manager. Whenever "Random Order" is checked, the orderby attribute is placed with a value of "rand" and if the checkbox is empty, then no orderby attribute is set.

The patch is adding another field that keeps the old value for persistence. If the "Random Order" value is not checked, the old orderby value is stored. If it is checked, then the value is updated - and finally if it was checked, but then unchecked, the orderby is cleared.

#2 @nofearinc
10 years ago

  • Cc mario@… added

#3 @markoheijnen
10 years ago

  • Cc koopersmith added
  • Keywords has-patch added; needs-patch removed

#4 @markoheijnen
10 years ago

  • Milestone changed from Awaiting Review to 3.7

#5 @nacin
10 years ago

This is not exactly a great fix, but I wasn't able to find a better solution.

Agree with the sentiment. Looks good at a glance.

#6 @markoheijnen
10 years ago

I just checked the code and to me it's good to go in.

#7 @johnbillion
10 years ago

  • Keywords commit added

Just chatted with Marko on this. Tested and confirmed as working.

#8 @nacin
10 years ago

  • Owner set to nacin
  • Resolution set to fixed
  • Status changed from new to closed

In 25720:

Prevent the removal of a manual 'orderby' attribute in the gallery shortcode.

props nofearinc.
fixes #24868.

Note: See TracTickets for help on using tickets.