[wp-trac] [WordPress Trac] #58183: PHP notice when accessing Customizer with a classic theme without widgets

WordPress Trac noreply at wordpress.org
Tue Apr 25 00:19:22 UTC 2023


#58183: PHP notice when accessing Customizer with a classic theme without widgets
--------------------------+------------------------------
 Reporter:  kraftner      |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Customize     |     Version:
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------

Comment (by westonruter):

 Seeing as the issue is specifically with the
 `WP_Customize_Widgets::output_widget_control_templates()` method, this is
 getting [https://github.com/WordPress/wordpress-
 develop/blob/26e3948fca904db17a588d3736b3db59f8007daa/src/wp-includes
 /class-wp-customize-widgets.php#L119 added] to the
 `customize_controls_print_footer_scripts` action in the class's
 ''constructor'':

 {{{#!php
 <?php
 add_action( 'customize_controls_print_footer_scripts', array( $this,
 'output_widget_control_templates' ) );
 }}}

 This method is expecting for the `widgets` panel to have been created, and
 this is done by another method that is registered previously in the
 constructor:

 {{{#!php
 <?php
 add_action( 'customize_register', array( $this,
 'schedule_customize_register' ), 1 );
 }}}

 In the admin, this `schedule_customize_register` calls the
 `customize_register` method right away. This method is what
 [https://github.com/WordPress/wordpress-
 develop/blob/26e3948fca904db17a588d3736b3db59f8007daa/src/wp-includes
 /class-wp-customize-widgets.php#L415-L426 registers the panel].

 So the panel should be registered. My guess is it may have something to do
 with the migration of widgets to blocks, and/or the incorporation of the
 Site Editor. But since happens in classic themes, I'm not sure.

 It seems this will take some deeper step debugging to identify what is
 going on. Nevertheless, right now I don't have this queued up to look at
 further.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/58183#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list