WP_Widget_Block::__construct() WordPress Method

The WP_Widget_Block::__construct() method is used to create a new block widget. This widget can be used to display a block of content in a sidebar or other widget area. The widget accepts a number of parameters to customize its behavior.

WP_Widget_Block::__construct() #

Sets up a new Block widget instance.


Source

File: wp-includes/widgets/class-wp-widget-block.php

	public function __construct() {
		$widget_ops  = array(
			'classname'                   => 'widget_block',
			'description'                 => __( 'A widget containing a block.' ),
			'customize_selective_refresh' => true,
			'show_instance_in_rest'       => true,
		);
		$control_ops = array(
			'width'  => 400,
			'height' => 350,
		);
		parent::__construct( 'block', __( 'Block' ), $widget_ops, $control_ops );

		add_filter( 'is_wide_widget_in_customizer', array( $this, 'set_is_wide_widget_in_customizer' ), 10, 2 );
	}


Top ↑

Changelog

Changelog
VersionDescription
5.8.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.