Instantly share code, notes, and snippets.

What would you like to do?
WordPress customizer custom tinymce control
class Text_Editor_Custom_Control extends WP_Customize_Control
public $type = 'textarea';
** Render the content on the theme customizer page
public function render_content() { ?>
<span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
$settings = array(
'media_buttons' => false,
'quicktags' => false
wp_editor($this->value(), $this->id, $settings );
private function filter_editor_setting_link() {
add_filter( 'the_editor', function( $output ) { return preg_replace( '/<textarea/', '<textarea ' . $this->get_link(), $output, 1 ); } );
function editor_customizer_script() {
wp_enqueue_script( 'wp-editor-customizer', get_template_directory_uri() . '/js/customizer-panel.js', array( 'jquery' ), rand(), true );
add_action( 'customize_controls_enqueue_scripts', 'editor_customizer_script' );

This comment has been minimized.

figuitiko commented Apr 26, 2017

it doesn't save ..


This comment has been minimized.

felipeelia commented Jun 14, 2017

For those who reached this like me, and are as asking where is customizer-panel.js, here it is:
To use it:


This comment has been minimized.


This comment has been minimized.

Fleuv commented Jun 7, 2018

This is a terrible way of fixing this issue, every time you use this class you will load +/- 300 scripts and other totally unrelated stuff. This will drastically decrease the performance of your website. A more correct way of fixing this problem is to enqueue the missing scripts via the customize_controls_enqueue_scripts, customize_controls_print_scripts or customize_controls_print_footer_scripts hook.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment