Title: WP_Widget_Custom_HTML::__construct
Published: November 20, 2017
Last modified: May 20, 2026

---

# WP_Widget_Custom_HTML::__construct()

## In this article

 * [Source](https://developer.wordpress.org/reference/classes/wp_widget_custom_html/__construct/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/classes/wp_widget_custom_html/__construct/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_widget_custom_html/__construct/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/classes/wp_widget_custom_html/__construct/?output_format=md#wp--skip-link--target)

Sets up a new Custom HTML widget instance.

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wp_widget_custom_html/__construct/?output_format=md#source)󠁿

    ```php
    public function __construct() {
    	$widget_ops  = array(
    		'classname'                   => 'widget_custom_html',
    		'description'                 => __( 'Arbitrary HTML code.' ),
    		'customize_selective_refresh' => true,
    		'show_instance_in_rest'       => true,
    	);
    	$control_ops = array(
    		'width'  => 400,
    		'height' => 350,
    	);
    	parent::__construct( 'custom_html', __( 'Custom HTML' ), $widget_ops, $control_ops );
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/widgets/class-wp-widget-custom-html.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/widgets/class-wp-widget-custom-html.php#L43)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/widgets/class-wp-widget-custom-html.php#L43-L55)

## 󠀁[Related](https://developer.wordpress.org/reference/classes/wp_widget_custom_html/__construct/?output_format=md#related)󠁿

| Uses | Description | 
| [WP_Widget::__construct()](https://developer.wordpress.org/reference/classes/wp_widget/__construct/)`wp-includes/class-wp-widget.php` |

PHP5 constructor.

  | 
| [__()](https://developer.wordpress.org/reference/functions/__/)`wp-includes/l10n.php` |

Retrieves the translation of $text.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wp_widget_custom_html/__construct/?output_format=md#changelog)󠁿

| Version | Description | 
| [4.8.1](https://developer.wordpress.org/reference/since/4.8.1/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_widget_custom_html%2F__construct%2F)
before being able to contribute a note or feedback.