how to use media library

hello i want to use wordpress media library . i want to user see the library when click on button i made and choose a picture and i get a link of picture wich user choosed . actualy i want to learn how we should use this library <button type="button" class="button button-primary">choose picture</button> i will … Read more

Audio file’s length (duration) is missing from Attachment Details in Media Library

I’m uploading a different mp3 file to each post as an attachment and using wp_get_attachment_metadata() to print the duration of the mp3 file. Sometimes the response from wp_get_attachment_metadata() does not contain the file length and when I inspect the mp3s inside the Media Library, some of them display a length and some do not:   … Read more

Removing extra large generated images disables all crops

function filter_image_sizes( $sizes) { unset( $sizes['1536×1536']); // disable 2x medium-large size unset( $sizes['2048×2048']); // disable 2x large size return $sizes; } add_filter('intermediate_image_sizes_advanced', 'filter_image_sizes'); I check the uploads folder and only the original image is being added now. I check the docs and I don’t think I see it removing all the crops because of it. … Read more

Not able to extend wp.media.view.AttachmentsBrowser

New to WP development here so please bear with me if I’m missing something simple…
I am writing a plugin for the Media upload library which needs to get the selected media items in Grid View (for drag & drop). I know that the items in the media grid are dynamically generated, so I’m trying to extend the AttachmentsBrowser, and get those elements there during initialize(). However, initialize() is never called.