Title: Media sorting
Last modified: August 21, 2016

---

# Media sorting

 *  Resolved [brianstanfill](https://wordpress.org/support/users/brianstanfill/)
 * (@brianstanfill)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/media-sorting/)
 * Your plugin does media filtering very well! Thank you! Does it support media 
   sorting in the Insert Media model?
 * WordPress offers rudimentary sorting (manual drag and drop) but no advanced sorting
   by file name, date, id, or otherwise.
 * For example: Images uploaded to the WordPress media library and inserted into
   a post immediately after uploading are displayed in a desirable ascending order;
   the image order is reversed if those images are selected from the media library(
   having already been uploaded).
 * [http://wordpress.org/plugins/media-library-assistant/](http://wordpress.org/plugins/media-library-assistant/)

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Plugin Author [David Lingren](https://wordpress.org/support/users/dglingren/)
 * (@dglingren)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/media-sorting/#post-4184624)
 * Thanks for the good words and for this question.
 * The current MLA version does not include any sorting features specific to the
   Media Manager and its Modal Window. I might consider adding something in a future
   version, but I’d like to know a bit more about what you want.
 * I can think of two types of sorting in the Modal Window. First, sorting the set
   of thumbnails in the middle of the window; the files you click on to choose items.
   Second, sorting the items at the bottom of the Create Gallery window; the files
   that will be added to the `[gallery]` shortcode on the post or page. Which of
   these two sorting applications are you asking about?
 * When you say “_(manual drag and drop)_” it sounds like you are asking about the`[
   gallery]` items.
 * I am not sure I understand your example. When you say “_inserted into a post_”
   do you mean IMG tags in the body of the post or items in a `[gallery]`? Are you
   referring to the order in the middle of the Modal Window when you pick “Uploaded
   to this post” from the dropdown in the upper-left corner of the window?
 * If you can give me more details it will help me think through what I can do to
   help. Thanks for your interest and your understanding.
 *  Thread Starter [brianstanfill](https://wordpress.org/support/users/brianstanfill/)
 * (@brianstanfill)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/media-sorting/#post-4184663)
 * Hi David, thanks for your swift response. I’ll follow up with clarifying details.
 * These screen captures show the WordPress default sorting behavior with [uploaded images](http://i.imgur.com/vOse1eh.png)
   and [images selected from the media library](http://i.imgur.com/9njADxb.png).
 * Ideally, I think custom sorting should occur alongside [your filtering and search tools](http://i.imgur.com/2l8v8BJ.png).
 * I personally would enjoy sorting by EXIF/IPTC meta data like the image capture
   date/time, but that is more complicated functionality than I truly need. A simple
   timestamp or filename sort with ASC/DSC options would suffice.
 * Regarding the Gallery, [WordPress offers a “reverse order” button](http://i.imgur.com/i33D3aG.png)
   that isn’t present for inserting individual media items.
 *  Plugin Author [David Lingren](https://wordpress.org/support/users/dglingren/)
 * (@dglingren)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/media-sorting/#post-4184719)
 * This is most helpful; thanks for taking the time to post the annotated screen
   shots.
 * Actually, the “_WordPress default sorting behavior_” is based on how you click
   on the images you want. For example, if you hold down the Control key (Windows
   PC) and click randomly on images in the window they are added to the list in 
   the order clicked. If you click an image, then hold down the shift key and click
   another image you get all the images in between the two in the order that they
   have in the window (left to right, top to bottom).
 * As you observed, the “ascending” order you want is an artifact of the drag-and-
   drop file uploading process; there’s no way to duplicate it once the files are
   in the Media Library.
 * The easy fix, when you’re selecting from the Media Library, is to hold down the
   control key (or the Mac equivalent) and click the images in the order you want.
 * Sorting all of the files that appear in the middle of the Modal Window is more
   difficult. The files you see are a subset of the files in the Media Library; 
   the Media Manager requests them in “pages” of forty images at a time and caches
   them in the browser. As you scroll down, more images are fetched from the server
   and added to the cache. Resorting the files you see would require clearing the
   cache and starting over. That’s possible, I believe.
 * The screen real estate required to add sorting to the Modal Window Toolbar is
   another issue. I have already had comments that this area is too crowded to begin
   with, especially for mobile devices. Of course, any sorting controls could be
   suppressed by a Settings option.
 * Another alternative would be to add a server-side Setting to specify the sort
   order for Modal Window items, as you can do now for the Media/Assistant submenu
   table. Would changing the default order (but not adding controls to the Modal
   Window itself) be useful?
 * I will continue to reflect on this, and I welcome any additional thoughts you
   have on the subject. Thanks again for a stimulating suggestion.
 *  Thread Starter [brianstanfill](https://wordpress.org/support/users/brianstanfill/)
 * (@brianstanfill)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/media-sorting/#post-4184843)
 * Clicking the images in the order I wish them to appear is a workable solution.
   It does become tiresome as the number of images increases.
 * WordPress queries the media library database entries and sorts them in some way.
   Can you intercept the query with a custom sorting value? Sure… having this set
   in the plugin settings would be okay.
 * Maybe the best place for client-side image sorting is in the lower queue instead
   of the media browser. Do you think there is room for a “reverse order” toggle
   of some kind?
 *  Plugin Author [David Lingren](https://wordpress.org/support/users/dglingren/)
 * (@dglingren)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/media-sorting/#post-4184847)
 * I’m glad the “clicking order” technique gives you some relief.
 * Yes, the plugin can “_intercept the query with a custom sorting value_“. In fact,
   that’s how MLA provides support for filtering the images by taxonomy term in 
   the current version. Adding sort criteria on the server side, based on a settings
   option, should be straight forward.
 * I can look at adding something to the lower queue. This would be on the browser
   side, requiring JavaScript coding that interacts with the Modal Window code in
   the Media Manager. I have found that to be a real challenge (as have other plugin
   authors).
 * I will see what I can do. Thanks again for thinking this through with me.
 *  Plugin Author [David Lingren](https://wordpress.org/support/users/dglingren/)
 * (@dglingren)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/media-sorting/#post-4184959)
 * I have done some work on this and I regret to report that the Media Manager will
   re-sort the items supplied by the server back to the default “date, descending”
   order. This is part of the Media Manager’s caching and incremental retrieval 
   logic and I can see no way to extend it to other sort orders.
 * Until the Media Manager is re-worked to allow modification of this kind, you 
   will have to live with the default functionality.
 * I am going to mark this issue resolved because there is nothing MLA can do to
   help. I regret that the news isn’t better; thanks for your understanding.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Media sorting’ is closed to new replies.

 * ![](https://ps.w.org/media-library-assistant/assets/icon-256x256.png?rev=973502)
 * [Media Library Assistant](https://wordpress.org/plugins/media-library-assistant/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/media-library-assistant/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/media-library-assistant/)
 * [Active Topics](https://wordpress.org/support/plugin/media-library-assistant/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/media-library-assistant/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/media-library-assistant/reviews/)

 * 6 replies
 * 2 participants
 * Last reply from: [David Lingren](https://wordpress.org/support/users/dglingren/)
 * Last activity: [12 years, 8 months ago](https://wordpress.org/support/topic/media-sorting/#post-4184959)
 * Status: resolved