Title: WP_Customize_Image_Control deprecated?
Last modified: September 13, 2019

---

# WP_Customize_Image_Control deprecated?

 *  [marek_step](https://wordpress.org/support/users/marek_step/)
 * (@marek_step)
 * [6 years, 8 months ago](https://wordpress.org/support/topic/wp_customize_image_control-deprecated/)
 * Hello all!
 * I followed the tutorial of Brad Traversy, which I recommend to everybody. Everything
   was clear until the last step: The customiser of the Image (showcase) of the 
   front-page. Is the `WP_Customize_Image_Control` deprecated? Do you see any problem
   in the code of `/inc/customizer.php` :
 *     ```
       	   $wp_customize->add_setting('showcase_image', array(
       		   'default'   =>  get_bloginfo('template_directory').'/img/showcase.jpg',
       		   'type'      =>  'theme_mod'
       	   ));
   
       	   $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'showcase_image', array(
       		   'label'     => __('Showcase Image', 'wpbootstrap'),
       		   'section'   => 'showcase',
       	       'settings'  => 'showcase_image',	   
       		   'priority'  => 1
       	   )));
       ```
   
 * And in the `front-page.php` itself is:
 *     ```
       	<style>
       	   .showcase{
       	      background: url(<?php echo get_theme_mod('showcase_image', get_blog_info('template_url').'/img/showcase.jpg'); ?>) no-repeat top center;
       	   }
       	</style>
       ```
   
 * I would be very grateful for any hint. Would like to finish this tutorial without
   any mistakes 🙂
 * Best greetings to all
 * marek

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Thread Starter [marek_step](https://wordpress.org/support/users/marek_step/)
 * (@marek_step)
 * [6 years, 8 months ago](https://wordpress.org/support/topic/wp_customize_image_control-deprecated/#post-11928413)
 * Sorry for the noise! First this is not the right forum and second there is a 
   silly mistake:
 *     ```
       get_blog_info WRONG! => get_bloginfo
       ```
   
 * Sorry again!
 *  [mrtom414](https://wordpress.org/support/users/mrtom414/)
 * (@mrtom414)
 * [6 years, 8 months ago](https://wordpress.org/support/topic/wp_customize_image_control-deprecated/#post-11931146)
 * I was looking for the error but can’t see it. The statement
    `'default' => get_bloginfo('
   template_directory').'/img/showcase.jpg'` should work since you are assigning
   it to an array. But, you shouldn’t have to repeat it in the get_theme_mod call
   setting the background.
 * you might want to wrap the url in esc_url to protect against hackers. I know 
   if either the name of the settings or the section is incorrect in the controller
   it will not create the control in the customizer. You might want to check the
   section name in the controller. It appears from your code the setting name is
   correct.
 * Is there anything showing up in the customizer at all?
    Also Bruce Chamoff has
   a nice course on the customizer at udemy. It not free but you can usually find
   it on sale for about $10.
    -  This reply was modified 6 years, 8 months ago by [mrtom414](https://wordpress.org/support/users/mrtom414/).
    -  This reply was modified 6 years, 8 months ago by [mrtom414](https://wordpress.org/support/users/mrtom414/).
 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [6 years, 8 months ago](https://wordpress.org/support/topic/wp_customize_image_control-deprecated/#post-11931150)
 * It’s not entirely deprecated, but some of its methods have been. The class is
   an extension of WP_Customize_Upload_Control. You could create your own class 
   based on the same that does whatever the customizer needs. Then pass your own
   class when adding your control. The deprecated code is still available for reference.
   I don’t know what the customizer needs from the class, nor why the methods were
   deprecated. I hope this is some help to you.
 *  Thread Starter [marek_step](https://wordpress.org/support/users/marek_step/)
 * (@marek_step)
 * [6 years, 7 months ago](https://wordpress.org/support/topic/wp_customize_image_control-deprecated/#post-11933237)
 * Thank you bcworkz and mrtom414 for your helpful answers. I am a Perl-Programmer–
   yes yes an old-fashioned Language – and pretty new to PHP. Off-topic question:
   is a hacker able to see the server side php-source?
 * Thank you again
 * marek
 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [6 years, 7 months ago](https://wordpress.org/support/topic/wp_customize_image_control-deprecated/#post-11933962)
 * Not if the server is properly configured to handle .php file extensions, assuming
   you are yet to be hacked. Once a hacker gains access, they may or may not be 
   able to see, depending on how deeply they were able to penetrate. The reason 
   for using esc_url() prior to output is really more to help protect your visitors
   in the off chance your site did get hacked. Additionally it helps ensure URLs
   in output will work as expected.
 * You protect your site from getting hacked in part by properly validating and 
   sanitizing user input.
 *  [lequynh](https://wordpress.org/support/users/lequynh/)
 * (@lequynh)
 * [6 years, 7 months ago](https://wordpress.org/support/topic/wp_customize_image_control-deprecated/#post-11935050)
 * That’s great. Thanks [@marek_step](https://wordpress.org/support/users/marek_step/)

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘WP_Customize_Image_Control deprecated?’ is closed to new replies.

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 6 replies
 * 4 participants
 * Last reply from: [lequynh](https://wordpress.org/support/users/lequynh/)
 * Last activity: [6 years, 7 months ago](https://wordpress.org/support/topic/wp_customize_image_control-deprecated/#post-11935050)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
