查看get_intermediate_image_sizes
函数代码解决了您的问题:
/**
* Gets the available intermediate image sizes.
*
* @since 3.0.0
*
* @global array $_wp_additional_image_sizes
*
* @return array Returns a filtered array of image size strings.
*/
function get_intermediate_image_sizes() {
global $_wp_additional_image_sizes;
$image_sizes = array(\'thumbnail\', \'medium\', \'medium_large\', \'large\'); // Standard sizes
if ( isset( $_wp_additional_image_sizes ) && count( $_wp_additional_image_sizes ) )
$image_sizes = array_merge( $image_sizes, array_keys( $_wp_additional_image_sizes ) );
/**
* Filter the list of intermediate image sizes.
*
* @since 2.5.0
*
* @param array $image_sizes An array of intermediate image sizes. Defaults
* are \'thumbnail\', \'medium\', \'medium_large\', \'large\'.
*/
return apply_filters( \'intermediate_image_sizes\', $image_sizes );
}
如您所见,您应用的过滤器没有在函数中调用。而是调用过滤器
wp_generate_attachment_metadata(). 因此,如果要过滤创建和列表的大小,可以添加另一个过滤器。