#33357 closed defect (bug) (invalid)
Customizer: Error with cropped-image control
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Customize | Keywords: | |
Focuses: | administration | Cc: |
Description
The example code for the cropped-image control in the following post generates an error: https://make.wordpress.org/core/2015/07/16/new-customizer-media-controls-in-4-3-and-4-2/
This code:
$wp_customize->add_control( new WP_Customize_Cropped_Image_Control( $wp_customize, 'cropped_image', array( 'section' => 'background_image', 'label' => __( 'Croppable Image' ), 'flex_width' => true, // Allow any width, making the specified value recommended. False by default. 'flex_height' => false, // Require the resulting image to be exactly as tall as the height attribute (default). 'width' => 1920, 'height' => 1080, ) ) );
Generates this error:
Fatal error: Call to a member function check_capabilities() on null in /var/www/site/public/wp/wp-includes/class-wp-customize-control.php on line 283
I use WordPress 4.3-RC2-33611
Change History (2)
Note: See
TracTickets for help on using
tickets.
Hello pekz0r and welcome to Trac.
You have to define a setting for
cropped_image
first. Add this before your snippet:WP_Customize_Manager::add_setting()
supports some arguments, seeWP_Customize_Setting
.