@utzer I think I fixed it! The screenshots below are from the Release Candidate (2026.08-rc). One of the changes to masonry layout is that if there's an odd number of images the last one now spans both columns.

Image

Image

As I said, by the time the array of images was getting to the masonry layout they were already in the wrong order, even though they are still in the correct order in the stored post content. It's because the functions to get the images don't go by the post content, they do a relational database search of the "post-media" table looking for rows that match the post UID number. And that is how the array of images is constructed.

Except it isn't given any sorting parameters. I couldn't figure out what the default sorting actually is, but it should be in ascending order of media ID number - because that is the same as the order the attachments are in the post body content. So I simply added those sorting parameters to the database query and now the images are in the correct order.

I'll be submitting a PR for this tomorrow to fix it in the Release Candidate.