admin管理员组

文章数量:1278910

The add_image_size function is used to add image sizes in addition to the default thumbnail, medium, large, & full which are generated in WordPress by default.

Is there any way to only add those image sizes for specific uploads? Or are we limited to generating all possible image sizes for every upload?

The add_image_size function is used to add image sizes in addition to the default thumbnail, medium, large, & full which are generated in WordPress by default.

Is there any way to only add those image sizes for specific uploads? Or are we limited to generating all possible image sizes for every upload?

Share Improve this question asked Oct 14, 2021 at 18:46 admcfajnadmcfajn 1,3262 gold badges13 silver badges30 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

Take a look at the intermediate_image_sizes_advanced filter. This filter receives the attachment ID in question, so with that you should be able to work out whether or not you want the intermediate sizes, and return an empty array if not.

本文标签: plugin developmentConditional Generation of Image Sizes using addimagesize