Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restrict the media library modal to display only supported images #21211

Open
Tracked by #21207
enricobattocchi opened this issue Mar 11, 2024 · 2 comments
Open
Tracked by #21207

Comments

@enricobattocchi
Copy link
Member

enricobattocchi commented Mar 11, 2024

We should research if there is a way to restrict the media library modal to display only the images in a subset of formats, namely JPG/PNG/GIF/WEBP, to make it easier for people to select a supported image when e.g. choosing a social media image in the metabox or in the settings.

@enricobattocchi
Copy link
Member Author

We could use this filter: ajax_query_attachments_args
The $query array should probably be something like this:

array (
  'post_mime_type' => 'image',
  'orderby' => 'date',
  'order' => 'DESC',
  'posts_per_page' => '80',
  'paged' => '1',
  'post_type' => 'attachment',
  'post_status' => 'inherit,private',
)

so editing the post_mime_type value would do the job
the problem is: we should apply this only to the social media case, and not interfere with thumbnail or content images selection.

It looks like ACF adds something to the $_POST array to make it easier: https://support.advancedcustomfields.com/forums/topic/filter-gallery-items/
They do it here

@pls78
Copy link
Member

pls78 commented Mar 26, 2024

I also found this filter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants