[wp-trac] [WordPress Trac] #53548: Widget Block: widget_id is undefined when a widget is placed
WordPress Trac
noreply at wordpress.org
Wed Jun 30 06:17:39 UTC 2021
#53548: Widget Block: widget_id is undefined when a widget is placed
-------------------------------+-----------------------------
Reporter: subrataemfluence | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: 5.8.1
Component: Widgets | Version: trunk
Severity: major | Resolution:
Keywords: reporter-feedback | Focuses: administration
-------------------------------+-----------------------------
Comment (by subrataemfluence):
As per your suggestion, I updated to 5.8-RC1 and the problem persists.
I am still getting Undefined Index error against `$args['widget_id']`
I am using a fresh 2021 theme and no additional plugin has been installed
except Akismet.
Here is my widget code:
{{{#!php
<?php
class Quick_Periodic_Table extends WP_Widget {
public $id_base = 'quick_periodic_table_id';
public function __construct() {
$widget_option = array(
'id' => $this->widget_id,
'classname' => 'quick_periodic_table_class',
'description' => __( 'Place a periodic table ' ),
'customize_selective_refresh' => true,
'show_instance_in_rest' => true,
);
$control_options = array(
'width' => '90%',
'id_base' => $this->id_base,
);
parent::__construct(
$this->id_base,
__( 'Quick Periodic Table', 'qpt' ),
$widget_option,
$control_options
);
}
...
public function widget( $args, $instance ) {
extract( $args ); ?>
<div id="<?= $args['widget_id'] ?>">
// ...
</div>
<?php }
...
}
add_action( 'widgets_init', function(){
register_widget( 'Quick_Periodic_Table' );
} );
}}}
Replying to [comment:1 desrosj]:
> Hi @subrataemfluence,
>
> Could you please retest using the beta4 release to see if this was
resolved? Beta3 should be considered outdated at this point.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/53548#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list