24

Ive created a custom post type and I want to hide the main textarea content in the publish/edit page.

Is it possible ?

Thanks!

1

5 Answers 5

47

Yes, remove the editor support from your custom post type.

You can do it in two ways.

  1. While registering your custom post type:

Example:

$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).

Example:

add_action('init', 'my_rem_editor_from_post_type');
function my_rem_editor_from_post_type() {
    remove_post_type_support( <POST TYPE>, 'editor' );
}
1
  • You can upload files using the media manager, or build your own custom meta box to handle the uploads. Commented May 24, 2011 at 9:52
14

When registering your custom post type don't specify support for editor.

 $args = array(
    'labels' => $labels,
    'public' => true,
    'publicly_queryable' => true,
    'show_ui' => true, 
    'show_in_menu' => true, 
    'query_var' => true,
    'rewrite' => true,
    'capability_type' => 'post',
    'has_archive' => true, 
    'hierarchical' => false,
    'menu_position' => null,
    // on the supports param here you see no 'editor'
    'supports' => array('title','author','thumbnail','excerpt','comments') 
  ); 
  register_post_type('book',$args);

More information See: Function Reference/register post type.

4

You can also set

'supports' => false

to avoid default (title and editor) behavior.

Note: this is for 3.5 or greater.

1
  • Ok, how you can generate and save/manage the content then?
    – TomeeNS
    Commented May 26, 2017 at 16:20
2

You can remove tittle or editor in admin of post module

function mvandemar_remove_post_type_support() {
    remove_post_type_support( 'post', 'title' );
    remove_post_type_support( 'post', 'editor' );
}
add_action( 'init', 'mvandemar_remove_post_type_support' );
1

You can also set editor false

$supports = array(
    'title', // post title
    'editor'=> false, // post content
    'author', // post author
    'thumbnail', // featured images
    'excerpt', // post excerpt
    'custom-fields', // custom fields
    'comments', // post comments
    'revisions', // post revisions
    'post-formats', // post formats
);

I hope this helps you

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.