Hide editor while keeping add media button in custom post type

How do I remove Editor in custom post type keeping the Add media button. When I used as following in custom post type declaration, it removes the Add Media button and I don’t need editor in my post type.

'supports' => array( 'title', 'thumbnail' ),

Thanks

Related posts

Leave a Reply

2 comments

  1. WordPress uses the function wp_editor() and there are no parameter that will disable the textarea (what i can see). So i think that you can just hide it with some css.

    function wpse_78595_hide_editor() {
        global $current_screen;
    
        if( $current_screen->post_type == 'custom_post_type_name' ) {
            $css = '<style type="text/css">';
                $css .= '#wp-content-editor-container, #post-status-info, .wp-switch-editor { display: none; }';
            $css .= '</style>';
    
            echo $css;
        }
    }
    add_action('admin_footer', 'wpse_78595_hide_editor');