Title: WP_Widget_Custom_HTML::form
Published: November 20, 2017
Last modified: August 20, 2026

---

# WP_Widget_Custom_HTML::form( array $instance )

## In this article

 * [Description](https://developer.wordpress.org/reference/classes/wp_widget_custom_html/form/?output_format=md#description)
    - [See also](https://developer.wordpress.org/reference/classes/wp_widget_custom_html/form/?output_format=md#see-also)
 * [Parameters](https://developer.wordpress.org/reference/classes/wp_widget_custom_html/form/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/classes/wp_widget_custom_html/form/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/classes/wp_widget_custom_html/form/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_widget_custom_html/form/?output_format=md#changelog)

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

Outputs the Custom HTML widget settings form.

## 󠀁[Description](https://developer.wordpress.org/reference/classes/wp_widget_custom_html/form/?output_format=md#description)󠁿

### 󠀁[See also](https://developer.wordpress.org/reference/classes/wp_widget_custom_html/form/?output_format=md#see-also)󠁿

 * [WP_Widget_Custom_HTML::render_control_template_scripts()](https://developer.wordpress.org/reference/classes/WP_Widget_Custom_HTML/render_control_template_scripts/)

## 󠀁[Parameters](https://developer.wordpress.org/reference/classes/wp_widget_custom_html/form/?output_format=md#parameters)󠁿

 `$instance`arrayrequired

Current instance.

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

    ```php
    public function form( $instance ) {
    	$instance = wp_parse_args( (array) $instance, $this->default_instance );
    	?>
    	<input id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" class="title sync-input" type="hidden" value="<?php echo esc_attr( $instance['title'] ); ?>" />
    	<textarea id="<?php echo $this->get_field_id( 'content' ); ?>" name="<?php echo $this->get_field_name( 'content' ); ?>" class="content sync-input" hidden><?php echo esc_textarea( $instance['content'] ); ?></textarea>
    	<?php
    }
    ```

[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.1/src/wp-includes/widgets/class-wp-widget-custom-html.php#L249)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/widgets/class-wp-widget-custom-html.php#L249-L255)

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

| Uses | Description | 
| [esc_textarea()](https://developer.wordpress.org/reference/functions/esc_textarea/)`wp-includes/formatting.php` |

Escaping for textarea values.

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

Escaping for HTML attributes.

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

Merges user defined arguments into defaults array.

  |

[Show 1 more](https://developer.wordpress.org/reference/classes/wp_widget_custom_html/form/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/classes/wp_widget_custom_html/form/?output_format=md#)

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

| Version | Description | 
| [4.9.0](https://developer.wordpress.org/reference/since/4.9.0/) | The form contains only hidden sync inputs. For the control UI, see `WP_Widget_Custom_HTML::render_control_template_scripts()`. | 
| [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%2Fform%2F)
before being able to contribute a note or feedback.