apply_filters( 'image_size_names_choose', array $size_names )

Filters the names and labels of the default image sizes.


Description Description


Parameters Parameters

$size_names

(array) Array of image sizes and their names. Default values include 'Thumbnail', 'Medium', 'Large', 'Full Size'.


Top ↑

Source Source

File: wp-admin/includes/media.php

View on Trac


Top ↑

Changelog Changelog

Changelog
Version Description
3.3.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

  1. Skip to note content
    Contributed by Rami Yushuvaev

    Add a new image sizes to the Media Library .

    // Add images sizes.
    function custom_theme_setup() {
    	add_image_size( 'custom-size-1', 1200, 300, true );
    	add_image_size( 'custom-size-2', 1000, 333, true );
    }
    add_action( 'after_setup_theme', 'custom_theme_setup' );
    
    // Make custom sizes selectable from WordPress admin.
    function custom_image_sizes( $size_names ) {
    	$new_sizes = array(
    		'custom-size-1' => __( 'Custom Size #1', 'generatewp.com' ),
    		'custom-size-2' => __( 'Custom Size #2', 'generatewp.com' ),
    	);
    	return array_merge( $size_names, $new_sizes );
    }
    add_filter( 'image_size_names_choose', 'custom_image_sizes' );
    

You must log in before being able to contribute a note or feedback.