add_post_type_support

Register support of certain features for a post type.

Description

add_post_type_support( (string) $post_type, (string|array) $feature ); 

All core features are directly associated with a functional area of the edit screen, such as the editor or a meta box. Features include: title,, editor., comments, revisions , trackbacks, author, excerpt, page-attributes, 'thumbnail', custom-fields, and post-formats.

Additionally, the revisions feature dictates whether the post type will store revisions, and the comments feature dictates whether the comments count will show on the edit screen.

Parameters (2)

0. $post_type (string)
The post type for which to add the feature.
1. $feature (string|array)
The feature being added, accepts an array of feature strings or a single string.

Usage

  1. if ( !function_exists( 'add_post_type_support' ) ) { 
  2. require_once ABSPATH . WPINC . '/post.php'; 
  3.  
  4. // The post type for which to add the feature. 
  5. $post_type = ''; 
  6.  
  7. // The feature being added, accepts an array of 
  8. // feature strings or a single string. 
  9. $feature = null; 
  10.  
  11. // NOTICE! Understand what this does before running. 
  12. $result = add_post_type_support($post_type, $feature); 
  13.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/post.php  
  1. function add_post_type_support( $post_type, $feature ) { 
  2. global $_wp_post_type_features; 
  3.  
  4. $features = (array) $feature; 
  5. foreach ($features as $feature) { 
  6. if ( func_num_args() == 2 ) 
  7. $_wp_post_type_features[$post_type][$feature] = true; 
  8. else 
  9. $_wp_post_type_features[$post_type][$feature] = array_slice( func_get_args(), 2 );