Filter the items inside of Gutenberg mediaUpload for a certain custom block

I want to use the core media picker inside of a block. For the block im working on I need to only return images that contain "xyz-". I can get my desired results GLOBALLY with the hook "ajax_query_attachments_args" I am using the mediaUpload component in my block. function filter_media_library_for_icons($query) { $query['meta_query'] = array( array( 'key' => '_wp_attached_file', 'value' => 'xyz-', // 'compare' => 'NOT LIKE', // exclude 'compare' => 'LIKE', 'type' => 'CHAR' ) ); return $query; } add_filter('ajax_query_attachments_args', 'filter_media_library_for_icons', 10, 1); I am looking for a way to achieve similar functionality but ONLY within a custom block. Any recommendations or places to look would be appricated! I cant use allowedTypes

Comment (0)

You’ll be in good company