Title: WP_Customize_Image_Control
Published: April 25, 2014
Last modified: February 24, 2026

---

# class WP_Customize_Image_Control {}

## In this article

 * [Description](https://developer.wordpress.org/reference/classes/wp_customize_image_control/?output_format=md#description)
    - [See also](https://developer.wordpress.org/reference/classes/wp_customize_image_control/?output_format=md#see-also)
 * [Methods](https://developer.wordpress.org/reference/classes/wp_customize_image_control/?output_format=md#methods)
 * [Source](https://developer.wordpress.org/reference/classes/wp_customize_image_control/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/classes/wp_customize_image_control/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_customize_image_control/?output_format=md#changelog)
 * [User Contributed Notes](https://developer.wordpress.org/reference/classes/wp_customize_image_control/?output_format=md#user-contributed-notes)

[ Back to top](https://developer.wordpress.org/reference/classes/wp_customize_image_control/?output_format=md#wp--skip-link--target)

Customize Image Control class.

## 󠀁[Description](https://developer.wordpress.org/reference/classes/wp_customize_image_control/?output_format=md#description)󠁿

### 󠀁[See also](https://developer.wordpress.org/reference/classes/wp_customize_image_control/?output_format=md#see-also)󠁿

 * [WP_Customize_Upload_Control](https://developer.wordpress.org/reference/classes/wp_customize_upload_control/)

## 󠀁[Methods](https://developer.wordpress.org/reference/classes/wp_customize_image_control/?output_format=md#methods)󠁿

| Name | Description | 
| [WP_Customize_Image_Control::add_tab](https://developer.wordpress.org/reference/classes/wp_customize_image_control/add_tab/) |  — deprecated | 
| [WP_Customize_Image_Control::prepare_control](https://developer.wordpress.org/reference/classes/wp_customize_image_control/prepare_control/) |  — deprecated | 
| [WP_Customize_Image_Control::print_tab_image](https://developer.wordpress.org/reference/classes/wp_customize_image_control/print_tab_image/) |  — deprecated | 
| [WP_Customize_Image_Control::remove_tab](https://developer.wordpress.org/reference/classes/wp_customize_image_control/remove_tab/) |  — deprecated |

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wp_customize_image_control/?output_format=md#source)󠁿

    ```php
    class WP_Customize_Image_Control extends WP_Customize_Upload_Control {
    	/**
    	 * Control type.
    	 *
    	 * @since 3.4.0
    	 * @var string
    	 */
    	public $type = 'image';

    	/**
    	 * Media control mime type.
    	 *
    	 * @since 4.1.0
    	 * @var string
    	 */
    	public $mime_type = 'image';

    	/**
    	 * @since 3.4.2
    	 * @deprecated 4.1.0
    	 */
    	public function prepare_control() {}

    	/**
    	 * @since 3.4.0
    	 * @deprecated 4.1.0
    	 *
    	 * @param string $id
    	 * @param string $label
    	 * @param mixed  $callback
    	 */
    	public function add_tab( $id, $label, $callback ) {
    		_deprecated_function( __METHOD__, '4.1.0' );
    	}

    	/**
    	 * @since 3.4.0
    	 * @deprecated 4.1.0
    	 *
    	 * @param string $id
    	 */
    	public function remove_tab( $id ) {
    		_deprecated_function( __METHOD__, '4.1.0' );
    	}

    	/**
    	 * @since 3.4.0
    	 * @deprecated 4.1.0
    	 *
    	 * @param string $url
    	 * @param string $thumbnail_url
    	 */
    	public function print_tab_image( $url, $thumbnail_url = null ) {
    		_deprecated_function( __METHOD__, '4.1.0' );
    	}
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/customize/class-wp-customize-image-control.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/customize/class-wp-customize-image-control.php#L17)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/customize/class-wp-customize-image-control.php#L17-L72)

## 󠀁[Related](https://developer.wordpress.org/reference/classes/wp_customize_image_control/?output_format=md#related)󠁿

| Uses | Description | 
| [WP_Customize_Upload_Control](https://developer.wordpress.org/reference/classes/wp_customize_upload_control/)`wp-includes/customize/class-wp-customize-upload-control.php` |

Customize Upload Control Class.

  |

| Used by | Description | 
| [WP_Customize_Cropped_Image_Control](https://developer.wordpress.org/reference/classes/wp_customize_cropped_image_control/)`wp-includes/customize/class-wp-customize-cropped-image-control.php` |

Customize Cropped Image Control class.

  | 
| [WP_Customize_Background_Image_Control](https://developer.wordpress.org/reference/classes/wp_customize_background_image_control/)`wp-includes/customize/class-wp-customize-background-image-control.php` |

Customize Background Image Control class.

  | 
| [WP_Customize_Header_Image_Control](https://developer.wordpress.org/reference/classes/wp_customize_header_image_control/)`wp-includes/customize/class-wp-customize-header-image-control.php` |

Customize Header Image Control class.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wp_customize_image_control/?output_format=md#changelog)󠁿

| Version | Description | 
| [3.4.0](https://developer.wordpress.org/reference/since/3.4.0/) | Introduced. |

## 󠀁[User Contributed Notes](https://developer.wordpress.org/reference/classes/wp_customize_image_control/?output_format=md#user-contributed-notes)󠁿

 1.   [Skip to note 4 content](https://developer.wordpress.org/reference/classes/wp_customize_image_control/?output_format=md#comment-content-1001)
 2.    [Ross Wintle](https://profiles.wordpress.org/magicroundabout/)  [  10 years ago  ](https://developer.wordpress.org/reference/classes/wp_customize_image_control/#comment-1001)
 3.  [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_customize_image_control%2F%23comment-1001)
     Vote results for this note: 13[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_customize_image_control%2F%23comment-1001)
 4.  Note that this control stores the URL of the image. If you want to store the ID
     of the image’s attachment then use [WP_Customize_Media_Control](https://developer.wordpress.org/reference/classes/wp_customize_media_control/).
 5.   [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_customize_image_control%2F%3Freplytocom%3D1001%23feedback-editor-1001)
 6.   [Skip to note 5 content](https://developer.wordpress.org/reference/classes/wp_customize_image_control/?output_format=md#comment-content-2035)
 7.    [Chetan Satasiya](https://profiles.wordpress.org/ketuchetan/)  [  9 years ago  ](https://developer.wordpress.org/reference/classes/wp_customize_image_control/#comment-2035)
 8.  [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_customize_image_control%2F%23comment-2035)
     Vote results for this note: 5[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_customize_image_control%2F%23comment-2035)
 9.  This class is used with the Theme Customization API to render the custom image
     control on the Theme Customizer in WordPress 3.4 or newer.
 10.     ```php
         $wp_customize->add_control(
                new WP_Customize_Image_Control(
                    $wp_customize,
                    'logo',
                    array(
                        'label'      => __( 'Upload a logo', 'theme_name' ),
                        'section'    => 'your_section_id',
                        'settings'   => 'your_setting_id',
                        'context'    => 'your_setting_context' 
                    )
                )
            );
         ```
     
 11.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_customize_image_control%2F%3Freplytocom%3D2035%23feedback-editor-2035)
 12.  [Skip to note 6 content](https://developer.wordpress.org/reference/classes/wp_customize_image_control/?output_format=md#comment-content-5368)
 13.   [Mehedi Foysal](https://profiles.wordpress.org/mehedi890/)  [  5 years ago  ](https://developer.wordpress.org/reference/classes/wp_customize_image_control/#comment-5368)
 14. [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_customize_image_control%2F%23comment-5368)
     Vote results for this note: 0[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_customize_image_control%2F%23comment-5368)
 15.     ```php
         $wp_customize->add_setting( 'logo', array(
         	'capability'        => 'edit_theme_options',
         	'default'           => '',
         	'sanitize_callback' => 'ic_sanitize_image',
         ) );
         $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'logo',
         	array(
         		'label'    => __( 'Logo', 'text-domain' ),
         		'section'  => 'general',
         		'settings' => 'logo',
         	)
         ) );
         ```
     
 16. **Callback function**
 17.     ```php
         /**
          * Validation: image
          * Control: text, WP_Customize_Image_Control
          *
          * @uses    wp_check_filetype()        https://developer.wordpress.org/reference/functions/wp_check_filetype/
          * @uses    in_array()                http://php.net/manual/en/function.in-array.php
          */
         function ic_sanitize_image( $file, $setting ) {
     
         	$mimes = array(
         		'jpg|jpeg|jpe' => 'image/jpeg',
         		'gif'          => 'image/gif',
         		'png'          => 'image/png',
         		'bmp'          => 'image/bmp',
         		'tif|tiff'     => 'image/tiff',
         		'ico'          => 'image/x-icon'
         	);
     
         	//check file type from file name
         	$file_ext = wp_check_filetype( $file, $mimes );
     
         	//if file has a valid mime type return it, otherwise return default
         	return ( $file_ext['ext'] ? $file : $setting->default );
         }
         ```
     
 18.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_customize_image_control%2F%3Freplytocom%3D5368%23feedback-editor-5368)

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_customize_image_control%2F)
before being able to contribute a note or feedback.