WordPress.org

Make WordPress Core

Opened 2 years ago

Last modified 2 years ago

#41854 new enhancement

Allow filters to be added for the Media Library in Grid Mode & Insert Media

Reported by: TigrouMeow Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.8.1
Component: Media Keywords:
Focuses: ui Cc:
PR Number:

Description

Hello,

I would like to suggest the action restrict_manage_posts and pre_get_posts to be used by the Media Library in Grid Mode. It would also be great to have this available in Insert Media or when picking a Featured Image. That will allow many developers to add useful filters and avoid users to look desperately for their images/photos :) Many users have been asking this and most of them believed it was a bug (List Mode and Grid mode look very similar so the absence of filters for the Grid Mode is actually not logical).

Thanks a lot :)

Change History (2)

#1 @birgire
2 years ago

Have you looked at the ajax_query_attachments_args filter ?

https://developer.wordpress.org/reference/hooks/ajax_query_attachments_args/

#2 @TigrouMeow
2 years ago

That would resolve one side of the issue, which is retrieving the attachments themselves.

The action "restrict_manage_posts" is called when the Media Library is displayed and when the filters are being displayed which give the chance to developers to add their own HTML to create/handle those filters. The only issue is that action is only called in list mode in the Media Library, I am not sure why. It seems like many other developers are waiting for this as well :)

Note: See TracTickets for help on using tickets.