New photos have a habit of landing at the very end of a WordPress gallery, behind shots you uploaded months ago.
The other version of the same problem is a gallery that opens on its weakest frame. Dragging thumbnails around one by one fixes it until the next upload.
The fix is to choose the order once, by hand or with an automatic rule, and let the gallery keep it from then on.
There are three ways to change the order of images in a WordPress gallery, and none of them needs code. Which one fits depends on how many photos you have and how often you add more.
Why the Order of Images in a WordPress Gallery Matters
The first few images in a gallery do most of the work. They’re what visitors judge the whole set by before they decide to scroll, click, or leave.
Order also decides how a story reads. A gallery from one shoot that jumps from the final frames back to the warm-up shots feels shuffled rather than told.
Some layouts raise the stakes further. In Envira Gallery, the WordPress gallery plugin, the Highlight Grid layout makes the first image, and every third one after it, a full-width highlight, so position decides which photos get promoted.
The Horizontal Carousel layout works the same way in a single row. Both layouts come with Envira Gallery’s paid plans. The first frames are on show, and the rest only appear for visitors who think to drag sideways.
Here’s a finished gallery on the front end of a site. Whatever sits in that top row sets the tone for everything below it.
If you’re still deciding how your gallery should look, our guide to WordPress gallery layouts explains what each layout does to your photos.
How to Reorder Images in the Default WordPress Gallery Block
If you built your gallery with the Gallery block that comes with WordPress, you can change the order right in the post editor.
Click any image inside the gallery to select it. Its toolbar shows a drag handle plus two arrows, Move left and Move right, which shift the image one position at a time.
For bigger jumps, hold the drag handle and pull the image straight to its new spot. Save or update the post when you’re done.
The block keeps things simple, and that’s also its limit. There’s no way to sort by title, date, or caption, and no setting that decides whether new uploads land at the start or the end.
For a handful of photos on one page, that’s fine. For a portfolio you update every month, rearranging each new batch by hand gets old fast.
How to Drag and Drop Images Into a Custom Order With Envira Gallery
Envira Gallery gives you a visual editor for your image order, and drag and drop is included in the free version, Envira Gallery Lite.
If you don’t have it yet, here’s how to install Envira Gallery Lite from your WordPress dashboard.
Next, create a gallery and add your photos. Our tutorial on creating an image gallery with thumbnails covers that part step by step.
Open the gallery and stay on the Gallery tab. Every image you’ve added appears as a thumbnail, in the same order visitors will see on your site.
To move a photo, click and hold its thumbnail, drag it to the new position, and let go. The other thumbnails shift over to make room.
The new order saves the moment you drop the image, so there’s no Update button to remember.
When I arrange a gallery by hand, I put the strongest frames first and a clear closing shot last, then fill in the middle. That way the gallery opens and ends on purpose.
How to Sort a WordPress Gallery by Title, Date, Caption, or Filename
Dragging works beautifully for twenty images. For two hundred, you’d rather set a rule and let the gallery do the arranging.
That’s what the Sorting dropdown is for. On all paid plans, it sits on the Gallery tab of the gallery editor, next to the Filter box, with a second dropdown beside it for the direction.
Direction is either Ascending (A-Z) or Descending (Z-A). Every new gallery starts on No Sorting and Ascending.
Each option sorts by something different:
- No Sorting: your own drag-and-drop order, exactly as you arranged it.
- Published Date: the date each image was added to your Media Library, not the date it was taken.
- Title, Caption, and Alt: the title, caption, or alt text you’ve given each image inside Envira Gallery.
- Filename and URL: the name of each image file, or the link URL set for each image in Envira Gallery (by default, the image’s own address).
- Random: a shuffled order, covered in the next section.
Filename is the one I reach for most, because camera files are usually numbered in the order you shot them.
Two things change once you pick a sort, and both are worth knowing before you click. First, any option other than No Sorting switches off drag and drop until you set it back.
Second, a sort rewrites the saved order straight away, even before you click Update. Switching back to No Sorting won’t bring your old hand-made order back, because the sorted order becomes your new starting point.
So if you’ve spent an afternoon arranging a gallery by hand, be sure you want the sorted version first. The two also work well together: sort to get the rough order, then switch to No Sorting and drag the few images that deserve a better spot.
Put Big Galleries in Order in One Click
Sort any gallery by title, caption, filename, or upload date, and choose whether new photos land first or last. Both come with every paid Envira Gallery plan.
How to Display WordPress Gallery Images in Random Order
Random order suits galleries where no single photo should own the top spot, like a large portfolio page or a mixed showcase of client work.
In the default Gallery block, select the whole gallery and open the Settings tab in the block sidebar. You’ll find a Randomize order toggle there, switched off by default.
In Envira Gallery, Random is one of the options in the Sorting dropdown on paid plans. Our doc on how to display thumbnails in a random order walks through it.
What surprises most people is that Random shuffles the gallery once and keeps that order until Envira Gallery refreshes its cache, which happens about once a day or when you update the gallery. It doesn’t deal a fresh order on every page load.
Random also behaves like every other sort. It rewrites your saved order and switches off drag and drop, so the advice from the previous section applies here too.
How to Control Where New Images Appear in an Existing Gallery
This setting fixes the “new photos land at the end” problem for good, across every gallery on your site.
On a paid plan, go to Envira Gallery » Settings and look for Add New Images in the Gallery section. It has two choices, Before Existing Images and After Existing Images.
After Existing Images is the default, so new uploads join the end of a gallery. Switch it to Before Existing Images and your latest work leads every time you add to a gallery that’s set to No Sorting. If a gallery uses a sort, new images slot in wherever the sort puts them.
It’s a site-wide setting, so you change it once instead of gallery by gallery. Our doc on how to configure Envira Gallery’s general settings covers the rest of that screen.
In the free version, new images always go to the end of the gallery. From there, you can drag them forward to wherever they belong.
How to Change the Order of Galleries in a WordPress Album
Once you have a few galleries, an album groups them on one page with a cover image for each. The same ordering question then comes up one level higher.
Albums come with the Albums addon, available on Pro plans and above. You build an album by dragging galleries in from the Available Galleries list, and with No Sorting, the album shows them in the order you set.
For an automatic order, open the album’s Configuration tab and use Sorting. The choices are No Sorting, Random, Published Date, Title, Caption, and Alt, each with an Ascending or Descending direction.
Two details differ from galleries. Published Date means the date each gallery was published, and album sorting doesn’t overwrite your saved arrangement, so it’s still there if you switch back to No Sorting.
A separate Lightbox Sort setting decides whether the lightbox follows the album’s sort or each gallery’s own. The Albums addon documentation has the full setup.
FAQs About Changing the Order of Images in a WordPress Gallery
Why can’t I drag and drop my gallery images?
In Envira Gallery, drag and drop switches off whenever the Sorting dropdown is set to anything other than No Sorting. Set it back to No Sorting and you can move the thumbnails again. The sorted order stays in place as your new starting point.
Can I sort images by the date they were taken?
Yes, with the Envira Gallery EXIF addon, which comes with the higher-tier paid plans. It adds a Capture Date option to the Sorting dropdown, so photos line up by the date your camera saved in each file. Without it, Published Date sorts by the date each image was added to your Media Library, and sorting by Filename usually gets you close.
Does reordering change my Media Library?
No. The order is saved with the gallery, not with the images, so your Media Library stays exactly as it was. That’s true for the default Gallery block and for Envira Gallery.
Can I randomize image order on every page load?
Yes, with the default Gallery block. Its Randomize order toggle reshuffles the images on each page load, as long as a caching plugin isn’t serving a saved copy of the page. Envira Gallery’s Random sort works differently: it keeps one shuffled order and refreshes it about once a day, or when you update the gallery.
Can I reorder galleries inside an album?
Yes, with the Envira Gallery Albums addon on Pro plans and above. You can arrange galleries by hand as you add them to the album, or use the album’s Sorting setting to order them by title, published date, caption, alt text, or at random.
Choose the order once, and every visitor sees your gallery the way you meant it. When you’re ready to group those galleries together, be sure to check out our post on how to create a photo album in WordPress.
Not using Envira Gallery yet? Get started today!
Don’t forget to follow us on Facebook and X (Twitter) for the best photography tips, resources, and WordPress tutorials.






How to reverse the image order in an existing gallery?
I need to show the gallery in a strange way, and I’m making my own shortcode to display it.
I use ‘_eg_in_gallery’ to retrieve the photo id’s, I have that part under control, but I need to know how to retrieve the order of the images like it is in the gallery editor.
Until now the images are allways displayed in the upload order.
Can you give me a hint?
Thanks!
Hi Dave, thanks for your question! Achieving what you’re describing would require a custom solution. If you’re comfortable with coding or working with a developer, you may be able to adjust things on your end, but Envira Gallery doesn’t currently offer a built-in option for customizing shortcode output like this. You’re welcome to reach out to our support team to see if they have any tips, though highly custom development is outside the scope of what we provide.