Powered by Blogger.

Hide content box with Custom Post Type in WordPress


Hide content box with Custom Post Type in WordPress

We can do this in two ways:
1. While registering your custom post type:
$args = array(
    'public' => true,
    'publicly_queryable' => true,
    'show_ui' => true, 
    'show_in_menu' => true, 
    'capability_type' => 'post',
    'has_archive' => true, 
    'supports' => array('title','author','thumbnail','excerpt','comments')
); 
register_post_type('book',$args);
2. Using the remove_post_type support if the custom post type is not defined by your code (i.e some other plugin/theme has defined custom post type).
add_action('init', 'my_rem_editor_from_post_type');
function my_rem_editor_from_post_type() {
    remove_post_type_support( <POST TYPE>, 'editor' );
}

No comments