admin管理员组文章数量:1194940
I am using following code to prevent WordPress from creating some un required image sizes for my theme and only upload the original size
add_filter( 'intermediate_image_sizes_advanced', 'prefix_remove_default_images' );
function prefix_remove_default_images( $sizes ) {
unset( $sizes['small']); // 150px
unset( $sizes['medium']); // 300px
unset( $sizes['large']); // 1024px
unset( $sizes['medium_large']); // 768px
return $sizes;
}
The code is somehow working and I am able to upload the original size but as you can see WordPress still generating 150x150
size images
As you can see I explicitly added unset( $sizes['small']);
to the code, but this is still happening! Can you please let me know what I am missing here?
I am using following code to prevent WordPress from creating some un required image sizes for my theme and only upload the original size
add_filter( 'intermediate_image_sizes_advanced', 'prefix_remove_default_images' );
function prefix_remove_default_images( $sizes ) {
unset( $sizes['small']); // 150px
unset( $sizes['medium']); // 300px
unset( $sizes['large']); // 1024px
unset( $sizes['medium_large']); // 768px
return $sizes;
}
The code is somehow working and I am able to upload the original size but as you can see WordPress still generating 150x150
size images
As you can see I explicitly added unset( $sizes['small']);
to the code, but this is still happening! Can you please let me know what I am missing here?
1 Answer
Reset to default 2That's because there is no image size called small
in WordPress. It's possible your theme registered it but the thumbnail size WordPress uses internally at 150x150 is named thumbnail
not small
本文标签:
版权声明:本文标题:plugin development - WP Still Generating 150x150 Thumbnail Size Even After Un-Setting Small Size in Functions.php 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738481354a2089160.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论