Title: WP_Widget_Custom_HTML::render_control_template_scripts
Published: November 20, 2017
Last modified: February 24, 2026

---

# WP_Widget_Custom_HTML::render_control_template_scripts()

## In this article

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

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

Render form template scripts.

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

    ```php
    public static function render_control_template_scripts() {
    	?>
    	<script type="text/html" id="tmpl-widget-custom-html-control-fields">
    		<# var elementIdPrefix = 'el' + String( Math.random() ).replace( /\D/g, '' ) + '_' #>
    		<p>
    			<label for="{{ elementIdPrefix }}title"><?php esc_html_e( 'Title:' ); ?></label>
    			<input id="{{ elementIdPrefix }}title" type="text" class="widefat title">
    		</p>

    		<p>
    			<label for="{{ elementIdPrefix }}content" id="{{ elementIdPrefix }}content-label"><?php esc_html_e( 'Content:' ); ?></label>
    			<textarea id="{{ elementIdPrefix }}content" class="widefat code content" rows="16" cols="20"></textarea>
    		</p>

    		<?php if ( ! current_user_can( 'unfiltered_html' ) ) : ?>
    			<?php
    			$probably_unsafe_html = array( 'script', 'iframe', 'form', 'input', 'style' );
    			$allowed_html         = wp_kses_allowed_html( 'post' );
    			$disallowed_html      = array_diff( $probably_unsafe_html, array_keys( $allowed_html ) );
    			?>
    			<?php if ( ! empty( $disallowed_html ) ) : ?>
    				<# if ( data.codeEditorDisabled ) { #>
    					<p>
    						<?php _e( 'Some HTML tags are not permitted, including:' ); ?>
    						<code><?php echo implode( '</code>, <code>', $disallowed_html ); ?></code>
    					</p>
    				<# } #>
    			<?php endif; ?>
    		<?php endif; ?>

    		<div class="code-editor-error-container"></div>
    	</script>
    	<?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/6.9.4/src/wp-includes/widgets/class-wp-widget-custom-html.php#L262)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/widgets/class-wp-widget-custom-html.php#L262-L295)

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

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

Displays translated text that has been escaped for safe use in HTML output.

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

Returns an array of allowed HTML tags and attributes for a given context.

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

Returns whether the current user has the specified capability.

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

Displays translated text.

  |

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

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

| Version | Description | 
| [4.9.0](https://developer.wordpress.org/reference/since/4.9.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_custom_html%2Frender_control_template_scripts%2F)
before being able to contribute a note or feedback.