replace the “medium” image size for media library
-
Hi
I am trying to replace the ‘medium’ image size with the ‘thumbnail’ image size for Media Library Grid View in order to make it load faster. I managed to find the below snippet from a thread on 2014. I am not sure if it is outdated therefore it does not work. Would you mind to point me to the right direction? Thanksadd_filter( 'wp_prepare_attachment_for_js', function( $response, $attachment, $meta ) { $use_size = 'thumbnail'; // Edit this to your needs. if( 'image' === $response['type'] && ! isset( $response['sizes']['medium'] ) ) { if( isset( $response['sizes'][$use_size] ) ) { $response['sizes']['medium'] = $response['sizes'][$use_size]; } else { $response['sizes']['medium'] = wp_get_attachment_image_src( $response['id'], $use_size ); } } return $response; }, 10, 3 );
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘replace the “medium” image size for media library’ is closed to new replies.