Image media 正在创建一个 768px 的新图像,但我该如何停止它?
Image media is creating a new image size of 768px but how do I stop it?
更新到 WordPress 4.5 后,我正在做一个媒体上传测试,我注意到我正在生成一个新的图像大小,我不知道如何停止。
我当前用来防止生成多种尺寸的媒体的函数是:
function add_image_insert_override( $sizes ) {
unset( $sizes[ 'thumbnail' ]);
unset( $sizes[ 'medium' ]);
unset( $sizes[ 'large' ]);
unset( $sizes[ 'full' ] );
return $sizes;
}
add_filter( 'intermediate_image_sizes_advanced', 'add_image_insert_override' );
如何阻止 WordPress 4.5 生成宽度为 768px 的图像?
除了我在 Responsive Images in WordPress 4.4 下引用的文章之外,我没有在其他任何地方找到它,当时他们指出已创建新的图像尺寸:
A new default intermediate size, medium_large
, has been added to
better take advantage of responsive image support. The new size is
768px wide by default, with no height limit, and can be used like any
other size available in WordPress. As it is a standard size, it will
only be generated when new images are uploaded or sizes are
regenerated with third party plugins.
读完这篇文章后,我可以将我的功能更新为:
function add_image_insert_override( $sizes ){
unset( $sizes[ 'thumbnail' ]);
unset( $sizes[ 'medium' ]);
unset( $sizes[ 'medium_large' ] );
unset( $sizes[ 'large' ]);
unset( $sizes[ 'full' ] );
return $sizes;
}
add_filter( 'intermediate_image_sizes_advanced', 'add_image_insert_override' );
现在,当我将媒体添加到 post 时,我不再生成 foobar-768xwhatever
。希望这对下一个人有帮助。
更新到 WordPress 4.5 后,我正在做一个媒体上传测试,我注意到我正在生成一个新的图像大小,我不知道如何停止。
我当前用来防止生成多种尺寸的媒体的函数是:
function add_image_insert_override( $sizes ) {
unset( $sizes[ 'thumbnail' ]);
unset( $sizes[ 'medium' ]);
unset( $sizes[ 'large' ]);
unset( $sizes[ 'full' ] );
return $sizes;
}
add_filter( 'intermediate_image_sizes_advanced', 'add_image_insert_override' );
如何阻止 WordPress 4.5 生成宽度为 768px 的图像?
除了我在 Responsive Images in WordPress 4.4 下引用的文章之外,我没有在其他任何地方找到它,当时他们指出已创建新的图像尺寸:
A new default intermediate size,
medium_large
, has been added to better take advantage of responsive image support. The new size is 768px wide by default, with no height limit, and can be used like any other size available in WordPress. As it is a standard size, it will only be generated when new images are uploaded or sizes are regenerated with third party plugins.
读完这篇文章后,我可以将我的功能更新为:
function add_image_insert_override( $sizes ){
unset( $sizes[ 'thumbnail' ]);
unset( $sizes[ 'medium' ]);
unset( $sizes[ 'medium_large' ] );
unset( $sizes[ 'large' ]);
unset( $sizes[ 'full' ] );
return $sizes;
}
add_filter( 'intermediate_image_sizes_advanced', 'add_image_insert_override' );
现在,当我将媒体添加到 post 时,我不再生成 foobar-768xwhatever
。希望这对下一个人有帮助。