: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
* Customize API: WP_Customize_Code_Editor_Control class
* Customize Code Editor Control class.
* @see WP_Customize_Control
class WP_Customize_Code_Editor_Control extends WP_Customize_Control {
* Customize control type.
public $type = 'code_editor';
* Type of code that is being edited.
* @see wp_enqueue_code_editor()
public $editor_settings = array();
* Enqueue control related scripts/styles.
public function enqueue() {
$this->editor_settings = wp_enqueue_code_editor(
'type' => $this->code_type,
* Refresh the parameters passed to the JavaScript via JSON.
* @see WP_Customize_Control::json()
* @return array Array of parameters passed to the JavaScript.
$json['editor_settings'] = $this->editor_settings;
$json['input_attrs'] = $this->input_attrs;
* Don't render the control content from PHP, as it's rendered via JS on load.
public function render_content() {}
* Render a JS template for control display.
public function content_template() {
<# var elementIdPrefix = 'el' + String( Math.random() ); #>
<# if ( data.label ) { #>
<label for="{{ elementIdPrefix }}_editor" class="customize-control-title">
<# if ( data.description ) { #>
<span class="description customize-control-description">{{{ data.description }}}</span>
<div class="customize-control-notifications-container"></div>
<textarea id="{{ elementIdPrefix }}_editor"
<# _.each( _.extend( { 'class': 'code' }, data.input_attrs ), function( value, key ) { #>
{{{ key }}}="{{ value }}"