How to remove some media upload icons from post editor?

I would like to remove some of the media upload buttons just above TinyMCE in the Add post screen, how can I do that? Thanks.

Related posts

Leave a Reply

3 comments

  1. If you want to get rid all all media buttons, you can remove the media_buttons action:

    add_action('admin_init', 'remove_all_media_buttons');
    
    function remove_all_media_buttons()
    {
        remove_all_actions('media_buttons');
    }
    

    Since you only want to remove some buttons, I suggest adding an admin stylesheet:

    add_action('admin_init', 'my_admin_stylesheet');
    
    function my_admin_stylesheet()
    {
        wp_enqueue_style('my_admin', get_bloginfo('template_url').'/css/my_admin.css');
    }
    

    In the my_admin.css you can hide the buttons:

    /* Hide the buttons you want */
    #add_image { display:none; }
    #add_video { display:none; }
    #add_audio { display:none; }
    #add_media { display:none; }
    
  2. In case someone wants to remove the media button on latest version of wordpress. Below is example for removing it for only posts. You can remove the if statement to make it disappear for all post types. Or add a CPT name if you want it remove on a CPT.

    add_action( 'admin_head' , 'product_remove_editor_upload' );
    function product_remove_editor_upload(){
        global $post;
        if(isset($post) && $post->post_type ==  'post'){
            remove_action( 'media_buttons', 'media_buttons' );
        }
    }
    

    Tested in 3.5.1