I would like to achieve the following (using a copy of twentytwelve):

  • Turn off custom-header theme support to prevent users being able to upload their own images (achieved)
  • Create own section in customize admin area (achieved)
  • Add a list containing thumbnails to be selected to replace header image. No upload capabilities.

I am trying to hook into customize_register and utilize WP_Customize_Image_Control but get it to only display a predefined list of images without the upload options. This post explains how to use the customize_register and in the additional notes towards the bottom goes onto describe what each control can do. It suggests WP_Customize_Image_Control is used to upload AND display a list of images. I just want a list.

This post shows you how to add the images to a 'default' tab but the original custom-header theme support has to be switched on which gives users the option to add header images from the admin page.

I know I could do it using a simple drop down menu but I like the selector window which provides a visual prompt.

Does anyone have a suggestion as to how I might utilize customize_register to achieve this?


2 Answers 2


I suggest you to build your own WP_Customize_Control class that does exactly what you want. You can copy-paste the core WP_Customize_Image_Control code on your own class and modify it to fit your needs.

You can follow Otto's guide to create a new control.

I personally use the Customizer API to modify the background-position CSS property of the background image using the mouse dragging movement (see the git repo).

  • Please don't just post links. Add the relevant codes to your answer, so the answer doesn't suffer from potential link rot.
    – kaiser
    Commented Aug 5, 2013 at 15:30
  • Instead of copy-pasting the existing code from WP_Customize_Image_Control into a new class, extend the class and change the relevant pieces to not have the upload control, if that's the desired behavior. Copy-pasta is usually a bad idea.
    – Otto
    Commented Aug 5, 2013 at 16:22
  • You find in this public repo also many examples and ready to use class for the WP Customizer.
    – bueltge
    Commented Aug 6, 2013 at 8:28

Thank you all for your responses. Being new to both WordPress and OOP, creating my own class seemed rather daunting. I have pieced together another solution which does the job.

To start, I turned custom-header theme support back on and then modified my functions.php file.

Firstly, I wanted to prevent users from accessing the 'Header' link from the main wp menu. From the header link they are able to upload images and therefore by adding the following code snippet, I was able to remove this from the admin menu:

add_action( 'admin_menu', 'adjust_the_wp_menu', 999 );
function adjust_the_wp_menu() {
  $page = remove_submenu_page( 'themes.php', 'custom-header' );

I then utilized the register_default_headers() function to load default images into the existing custom_header. I am not certain how, but this has also provided the required functionality of stopping uploads from the customize window. A tab called 'Default' has been created alongside 'Uploaded' under Header Image in the customize theme view.

add_action( 'after_setup_theme', 'add_default_banner_images' );    
if ( ! function_exists('add_default_banner_images') ):    
    define( 'HEADER_IMAGE', '%s/banners/5.jpg' );       
        array (
            'head' => array (
                'url' => '%s/banners/1.jpg',
                'thumbnail_url' => '%s/banners/1.jpg',
                'description' => __( 'Image 01', 'twentytwelve_mod' )
            'vision' => array (
                'url' => '%s/banners/2.jpg',
                'thumbnail_url' => '%s/banners/2.jpg',
                'description' => __( 'Image 02', 'twentytwelve_mod' )
            'gallery' => array (
                'url' => '%s/banners/3.jpg',
                'thumbnail_url' => '%s/banners/3.jpg',
                'description' => __( 'Image 03', 'twentytwelve_mod' )
            'sea' => array (
                'url' => '%s/banners/4.jpg',
                'thumbnail_url' => '%s/banners/4.jpg',
                'description' => __( 'Image 04', 'twentytwelve_mod' )
            'orangeworld' => array (
                'url' => '%s/banners/5.jpg',
                'thumbnail_url' => '%s/banners/5.jpg',
                'description' => __( 'Image 05', 'twentytwelve_mod' )

And finally, I removed the unwanted 'Uploaded' tab under Header Image by utilizing the 'cusomize_register' hook:

add_action( 'customize_register', 'customize_register_mytheme' );
function customize_register_mytheme( $wp_customize ) {

    //Remove 'uploaded' tab from control 'header_image'
    $controlHeaderImage = $wp_customize->get_control( 'header_image' );     
    $controlHeaderImage->remove_tab( 'uploaded' );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.