Archived topic
How to Deregister unused image sizes?
1 reply · Started by Atef on July 15, 2021
Hi,
I can see on my website that I have 3 unused image sizes. I assume they maybe generated by Generatepress?
If so, how can I deregister them, please?
the image size names are:
medium_large: 768×0 pixels (proportionally resized to fit inside dimensions)
1536x1536: 1536×1536 pixels (proportionally resized to fit inside dimensions)
2048x2048: 2048×2048 pixels (proportionally resized to fit inside dimensions)
Thanks in advance
Hi there,
You can use WordPress' remove_image_size().
https://developer.wordpress.org/reference/functions/remove_image_size/
Here's a good example:
https://developer.wordpress.org/reference/functions/remove_image_size/#comment-2612
Which we can basically rewrite to remove image sizes.
Example:
add_action( 'init', 'remove_sizes' );
function remove_sizes() {
remove_image_size( 'medium_large' );
remove_image_size( '1536×1536' );
remove_image_size( '2048×2048' );
}