Make WordPress Core

Opened 2 years ago

Last modified 2 years ago

#42075 new defect (bug)

Do not show default image on using WP_Customize_Cropped_Image_Control.

Reported by: Toro_Unit Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.8.2
Component: Customize Keywords: has-patch
Focuses: administration Cc:
PR Number:


Add New Control use WP_Customize_Cropped_Image_Control.
Do not Show default image.

But show Default button. When click the button, nothing happens.

Instead of using WP_Customize_Image_Control, Show image.

function foo_customize_register( WP_Customize_Manager $wp_customize ) {

        $wp_customize->add_section( 'theme_options', array(
                'title'    => __( 'Theme Options' ),
        ) );

        $wp_customize->add_setting( 'custom_image', array(
                'default' => get_parent_theme_file_uri( '/images/default-header.jpg' ),
        ) );

        $wp_customize->add_control( new WP_Customize_Cropped_Image_Control( $wp_customize, 'custom_image', array(
                                'label'   => __( 'Upload an Image' ),
                                'section' => 'theme_options',
                                'width'              => 1920,
                                'height'             => 1080,

add_action( 'customize_register', 'foo_customize_register' );

Attachments (1)

patch.diff (648 bytes) - added by Toro_Unit 2 years ago.

Download all attachments as: .zip

Change History (5)

2 years ago

#1 @Toro_Unit
2 years ago

  • Version set to 4.8.2

#2 @Toro_Unit
2 years ago

  • Keywords has-patch added

#3 follow-up: @celloexpressions
2 years ago

patch.diff seems likely to potentially break a lot of things. Can you please explain what the issue is in more detail @Toro_Unit? Hopefully there's a fix within the JS for the cropped image control, rather than my changing which control it extends (which has other implications).

#4 in reply to: ↑ 3 @Toro_Unit
2 years ago

Thanks reply @celloexpressions !

Created sample theme https://github.com/torounit/42075

And Movie.


Do not set default setting, There is no problem.

WP_Customize_Cropped_Image_Control support default image support. But not support in the case of js.

Note: See TracTickets for help on using tickets.