Languages: English • Italiano • (Add your language)
The 'image_size_names_choose' filter allows modification of the list of image sizes that are available to administrators in the WordPress Media Library.
This is most commonly used to make custom image sizes available from selection in the WordPress admin.
The following will add a new image size option to the list of selectable sizes in the Media Library.
add_filter( 'image_size_names_choose', 'my_custom_sizes' ); function my_custom_sizes( $sizes ) { return array_merge( $sizes, array( 'your-custom-size' => __('Your Custom Size Name'), ) ); }
As of WordPress 3.8 this hook is applied in the following locations:
wp-admin/custom-background.php
- in wp_set_background_image() on line 417wp-admin/includes/media.php
- in image_size_input_fields() on line 930wp-includes/media-template.php
- in wp_print_media_templates() on line 352wp-includes/media.php
- in wp_prepare_attachment_for_js() on line 1837