最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

media - Disable Responsive Image Sizes crop

programmeradmin0浏览0评论

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.

发布评论

评论列表(0)

  1. 暂无评论