The remove_post_type_support() WordPress PHP function removes support for a specific feature from a post type.
Usage
remove_post_type_support( $post_type, $feature );
Example:
remove_post_type_support( 'page', 'editor' );
This will remove the editor feature from the ‘page’ post type.
Parameters
- $post_type (string) – The post type for which to remove the feature.
- $feature (string) – The feature being removed.
More information
See WordPress Developer Resources: remove_post_type_support()
Examples
Hide page visual editor if certain template is selected
This code removes the visual editor for pages with a specific template (e.g. ‘page-your-template.php’).
add_action( 'init', 'remove_editor_init' );
function remove_editor_init() {
  // If not in the admin, return.
  if ( ! is_admin() ) {
    return;
  }
  // Get the post ID
  $current_post_id = filter_input( INPUT_GET, 'post', FILTER_SANITIZE_NUMBER_INT );
  $update_post_id = filter_input( INPUT_POST, 'post_ID', FILTER_SANITIZE_NUMBER_INT );
  // Check to see if the post ID is set
  if ( isset( $current_post_id ) ) {
    $post_id = absint( $current_post_id );
  } else if ( isset( $update_post_id ) ) {
    $post_id = absint( $update_post_id );
  } else {
    return;
  }
  // Get the template of the current post
  $template_file = get_post_meta( $post_id, '_wp_page_template', true );
  // Remove page editor for specific template
  if ( 'page-your-template.php' === $template_file ) {
    remove_post_type_support( 'page', 'editor' );
  }
}
Remove support for excerpts
This example removes support for excerpts in posts:
function wpdocs_custom_init() {
  remove_post_type_support( 'post', 'excerpt' );
}
add_action( 'init', 'wpdocs_custom_init' );
Remove support for post formats
This example removes support for post formats in posts:
function wpdocs_remove_post_type_support() {
  remove_post_type_support( 'post', 'post-formats' );
}
add_action( 'init', 'wpdocs_remove_post_type_support', 10 );
Remove comments from all pages
A simple way to remove comments from all pages:
function wpdocs_disable_comments_on_pages() {
  remove_post_type_support( 'page', 'comments' );
}
add_action( 'init', 'wpdocs_disable_comments_on_pages' );