您需要先使用add_image_size()
, 例如:
add_action( \'after_setup_theme\', \'cyb_add_image_sizes\' );
function cyb_add_image_sizes() {
add_image_size( \'my-image-size-name\', 120, 120, true );
}
然后,您可以使用
image_size_names_choose
过滤器(您将其拼错了
image_size_names_chooser
):
add_filter( \'image_size_names_choose\', \'rudr_new_image_sizes\' );
function rudr_new_image_sizes( $sizes ) {
$addsizes = array(
"my-image-size-name" => \'Misha size\'
);
$newsizes = array_merge( $sizes, $addsizes );
return $newsizes;
}