Hide “Add media”, HTML editor from TinyMCE

I have a custom post type which supports editor. (WordPress version 3.5)

I want to customize the editor for it.

Read More
  1. Make it readonly
  2. Hide “Add Media” button
  3. Hide HTML editor
  4. Remove status bar showing word count

I am using the following code:

add_filter( 'tiny_mce_before_init', function( $args ) {
     $args['readonly'] = 1;
     $args['media_buttons'] = 0;
     $args['theme_advanced_disable'] = "code";
     return $args;
});

Only readonly is working. Is it not possible to do other customization using tiny_mce_before_init?

Related posts

Leave a Reply

3 comments

  1. It should be 'media_buttons' => FALSE.

    array (
        'textarea_rows' => 5,
        'media_buttons' => FALSE,
        'teeny'         => TRUE,
        'tinymce'       => TRUE
    )
    

    … creates this editor:

    enter image description here

  2. If you want to hide/disable/prevent/remove the “Add Media”-button in 2018 you can do the following (in essence):

    // probably in your functions.php
    remove_action('media_buttons', 'media_buttons');
    
  3. In WordPress ver 4.9 it does not seem media buttons can be turned off using the ‘tiny_mce_before_init’ hook.

    Instead I was able to remove this using ‘wp_editor_settings’, like so:

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