Title: WP_Widget_Block::form
Published: July 20, 2021
Last modified: August 20, 2026

---

# WP_Widget_Block::form( array $instance )

## In this article

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

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

Outputs the Block widget settings form.

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

### 󠀁[See also](https://developer.wordpress.org/reference/classes/wp_widget_block/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_block/form/?output_format=md#parameters)󠁿

 `$instance`arrayrequired

Current instance.

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

    ```php
    public function form( $instance ) {
    	$instance = wp_parse_args( (array) $instance, $this->default_instance );
    	?>
    	<p>
    		<label for="<?php echo $this->get_field_id( 'content' ); ?>">
    			<?php
    			/* translators: HTML code of the block, not an option that blocks HTML. */
    			_e( 'Block HTML:' );
    			?>
    		</label>
    		<textarea id="<?php echo $this->get_field_id( 'content' ); ?>" name="<?php echo $this->get_field_name( 'content' ); ?>" rows="6" cols="50" class="widefat code"><?php echo esc_textarea( $instance['content'] ); ?></textarea>
    	</p>
    	<?php
    }
    ```

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

## 󠀁[Related](https://developer.wordpress.org/reference/classes/wp_widget_block/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.

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

Displays translated text.

  | 
| [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_block/form/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/classes/wp_widget_block/form/?output_format=md#)

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

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

## User Contributed Notes

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