media - Disable Responsive Image Sizes crop

admin2025-03-20  6

I think my question might similar to others.Here is my problem, I want to remove generating wordpress responsive images because I have done image responsive solution with my way. So, I don't wanna save any auto generated images from wordpress in my server.

When I google it, most show how to remove from tag at frontend.

I think my question might similar to others.Here is my problem, I want to remove generating wordpress responsive images because I have done image responsive solution with my way. So, I don't wanna save any auto generated images from wordpress in my server.

When I google it, most show how to remove from tag at frontend.

Share Improve this question asked May 20, 2020 at 14:47 PorPor 4024 silver badges12 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

If you mean you want to only save the original image to the server, and not have WP auto-generate additional sizes, there's a function to remove the additional sizes:

<?php
function wpse_remove_image_sizes() {
    // Remove the WP Core "thumbnail" size
    remove_image_size( 'thumbnail' );
    // Remove a custom image size with the slug "custom-size-name"
    remove_image_size( 'custom-size-name' );
    // Add any other sizes you need to remove -
    // this will depend on your theme and plugins.
}
add_action('init', 'wpse_remove_image_sizes');
?>

Proceed with caution, because many themes and some plugins use these other sizes, particularly the thumbnail.

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1742415852a212655.html

最新回复(0)