WordPress.org

Make WordPress Core

Opened 3 years ago

Last modified 2 days ago

#44511 new defect (bug)

Widgets generated by wp_register_sidebar_widget can not be add via customizer

Reported by: bastho Owned by:
Milestone: 6.0 Priority: normal
Severity: major Version: 4.9.6
Component: Customize Keywords: needs-testing
Focuses: Cc:

Description

Single use widgets, generated by wp_register_sidebar_widget and managed by wp_register_widget_control always return an "Invalid value" error in Customizer. They also block saving in Customizer.

We still can add them via appearance/widgets.php and go back to customizer.

Example to reproduce:

<?php
add_action('widgets_init', 'proof_of_concept_register_widget');
function proof_of_concept_register_widget(){
    wp_register_sidebar_widget(
        'poc_widget',
        'POC Widget',
        'poc_widget_display',
        array(
        'description' => 'POC for Customize bug'
        )
    );
    wp_register_widget_control('poc_widget', 'poc_widget', 'poc_widget_control');
}
function poc_widget_display(){
    echo '<p>POC for Customize bug</p>';
}
function poc_widget_control(){
    echo '<p>You should see a red notice "Invalid value" just above</p>';
}


Change History (3)

#1 @celloexpressions
6 months ago

  • Keywords needs-testing added
  • Milestone changed from Awaiting Review to 5.8

There is some logic in the old customize widgets class to address "single" (as opposed to "multi") widgets. However, it sounds like that may have broken at some point.

Now that widgets are replaced with blocks in 5.8, we need to confirm that "single" widgets "still" work. If they do, then this can likely be closed as fixed in 5.8. If they don't but we can confirm they were broken on 5.7 also, then this can maybe move to Future Release.

Given that the block inserter replaces the add-widgets panel in the customizer, this would probably need to be fixed with 5.8 as the widgets screen would also be broken now. Another option would be to formally deprecate "single" widgets.

#2 @hellofromTonya
6 months ago

  • Milestone changed from 5.8 to 5.9

Today is 5.8 Beta 1. Investigation is ongoing. Punting to 5.9.

#3 @hellofromTonya
2 days ago

  • Milestone changed from 5.9 to 6.0

5.9 Beta 1 is in < 19 hours. With no movement on this ticket, moving to 6.0 for further investigation.

Note: See TracTickets for help on using tickets.