I can't seem to find a way to change the size of the images in the Media Library. For some reason the full picture is being loaded in the media library, and this makes it really slow. I've tried:

Changing the post-thumbnail, medium and medium_large values with add_image_size( 'post-thumbnail', 180, 180, true );
Tried hooking in on shortcode_atts_gallery with no effect when changing the $output['size'] value

Is there any way I can make Wordpress fetch the cropped versions of these pictures rather than displaying the full image?

1 Answer 1


This was an interesting question as I knew nothing about modifying the default behaviour of the Media Library. So, I ended up doing some research on the matter.

I found out that the Media Library uses wp_ajax_query_attachments() to get the images and other media. Inside the ajax function there's ajax_query_attachments_args that can be used to modify the arguments for the attachment WP_Query.

After the WP_Query the ajax function uses wp_prepare_attachment_for_js (function and filter) on the queried posts before they are sent back with wp_send_json_success().

Perhaps you could try playing around with wp_prepare_attachment_for_js filter and see, if you can achieve the result you want.

  • Thanks for the suggestion! This might get me a solution.
    – Ted
    Feb 25, 2019 at 14:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.