Darth Mikey D
Darth Mikey D

Reputation: 109

Remove toolbar from single wp_editor

I have the following code to remove toolbar, media buttons, and visual buttons on my wp_editor. The code is working, but I want it to only remove the items from one wp_editor, not all. Any help is appreciated.

Wp_editor code

$content = '';
$editor_id = 'message';
$settings = array(
    'textarea_name' => 'message',
    'textarea_rows' => 10,
);
wp_editor( $content, $editor_id, $settings );

Code to hide items

function my_format_TinyMCE( $in ) {
    $in['toolbar1'] = '';
    $in['toolbar2'] = '';
    $in['toolbar'] = false;
    return $in;
}
add_filter( 'tiny_mce_before_init', 'my_format_TinyMCE' );

add_filter( 'wp_editor_settings', function($settings) {
    $settings['media_buttons']=FALSE;
    $settings['quicktags']=FALSE;
    return $settings;
});

Upvotes: 0

Views: 958

Answers (1)

Saf
Saf

Reputation: 318

You can set tinymce setting in editor settings

$content = '';
$editor_id = 'message';
$settings = array(
    'textarea_name' => 'message',
    'textarea_rows' => 10,
    'tinymce'       => array(
        'toolbar1'      => '',
        'toolbar2'      => '',
        'toolbar3'      => '',
    ),
);
wp_editor( $content, $editor_id, $args );

Upvotes: 1

Related Questions