WordPress.org

Make WordPress Core

Opened 3 weeks ago

#44511 new defect (bug)

Widgets generated by wp_register_sidebar_widget can not be add via customizer

Reported by: bastho Owned by:
Milestone: Awaiting Review Priority: normal
Severity: major Version: 4.9.6
Component: Customize Keywords:
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 (0)

Note: See TracTickets for help on using tickets.