image_size_names_choose хук-фильтрWP 3.3.0

Filters the names and labels of the default image sizes.

Использование

add_filter( 'image_size_names_choose', 'wp_kama_image_size_names_choose_filter' );

/**
 * Function for `image_size_names_choose` filter-hook.
 * 
 * @param string[] $size_names Array of image size labels keyed by their name.
 *
 * @return string[]
 */
function wp_kama_image_size_names_choose_filter( $size_names ){

	// filter...
	return $size_names;
}
$size_names(string[])
Array of image size labels keyed by their name.
По умолчанию: values include 'Thumbnail', 'Medium', 'Large', and 'Full Size'

Список изменений

С версии 3.3.0 Введена.

Где вызывается хук

image_size_input_fields()
image_size_names_choose
get_default_block_editor_settings()
image_size_names_choose
wp_print_media_templates()
image_size_names_choose
wp_prepare_attachment_for_js()
image_size_names_choose
Custom_Background::wp_set_background_image()
image_size_names_choose
wp-admin/includes/media.php 1183-1191
$size_names = apply_filters(
	'image_size_names_choose',
	array(
		'thumbnail' => __( 'Thumbnail' ),
		'medium'    => __( 'Medium' ),
		'large'     => __( 'Large' ),
		'full'      => __( 'Full Size' ),
	)
);
wp-includes/block-editor.php 162-170
$image_size_names = apply_filters(
	'image_size_names_choose',
	array(
		'thumbnail' => __( 'Thumbnail' ),
		'medium'    => __( 'Medium' ),
		'large'     => __( 'Large' ),
		'full'      => __( 'Full Size' ),
	)
);
wp-includes/media-template.php 851-859
$sizes = apply_filters(
	'image_size_names_choose',
	array(
		'thumbnail' => __( 'Thumbnail' ),
		'medium'    => __( 'Medium' ),
		'large'     => __( 'Large' ),
		'full'      => __( 'Full Size' ),
	)
);
wp-includes/media-template.php 931-939
$size_names = apply_filters(
	'image_size_names_choose',
	array(
		'thumbnail' => __( 'Thumbnail' ),
		'medium'    => __( 'Medium' ),
		'large'     => __( 'Large' ),
		'full'      => __( 'Full Size' ),
	)
);
wp-includes/media-template.php 1122-1130
$sizes = apply_filters(
	'image_size_names_choose',
	array(
		'thumbnail' => __( 'Thumbnail' ),
		'medium'    => __( 'Medium' ),
		'large'     => __( 'Large' ),
		'full'      => __( 'Full Size' ),
	)
);
wp-includes/media.php 4099-4107
$possible_sizes = apply_filters(
	'image_size_names_choose',
	array(
		'thumbnail' => __( 'Thumbnail' ),
		'medium'    => __( 'Medium' ),
		'large'     => __( 'Large' ),
		'full'      => __( 'Full Size' ),
	)
);
wp-admin/includes/class-custom-background.php 601-609
apply_filters(
	'image_size_names_choose',
	array(
		'thumbnail' => __( 'Thumbnail' ),
		'medium'    => __( 'Medium' ),
		'large'     => __( 'Large' ),
		'full'      => __( 'Full Size' ),
	)
)

Где используется хук в WordPress

wp-admin/includes/ajax-actions.php 3948
add_filter( 'image_size_names_choose', array( $wp_site_icon, 'additional_sizes' ) );
wp-admin/includes/ajax-actions.php 3963
add_filter( 'image_size_names_choose', array( $wp_site_icon, 'additional_sizes' ) );