#33357 closed defect (bug) (invalid)
Customizer: Error with cropped-image control
| Reported by: | pekz0r | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Customize | Version: | |
| Severity: | normal | Keywords: | |
| Cc: | Focuses: | administration |
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.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Hello pekz0r and welcome to Trac.
You have to define a setting for
cropped_imagefirst. Add this before your snippet:WP_Customize_Manager::add_setting()supports some arguments, seeWP_Customize_Setting.