add_post_type_support

The timeline below displays how wordpress function add_post_type_support has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 5.3

/**
 * Registers support of certain features for a post type.
 *
 * 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.
 *
 * A third, optional parameter can also be passed along with a feature to provide
 * additional information about supporting that feature.
 *
 * Example usage:
 *
 *     add_post_type_support( 'my_post_type', 'comments' );
 *     add_post_type_support( 'my_post_type', array(
 *         'author', 'excerpt',
 *     ) );
 *     add_post_type_support( 'my_post_type', 'my_feature', array(
 *         'field' => 'value',
 *     ) );
 *
 * @since 3.0.0
 * @since 5.3.0 Formalized the existing and already documented `...$args` parameter
 *              by adding it to the function signature.
 *
 * @global array $_wp_post_type_features
 *
 * @param string       $post_type The post type for which to add the feature.
 * @param string|array $feature   The feature being added, accepts an array of
 *                                feature strings or a single string.
 * @param mixed        ...$args   Optional extra arguments to pass along with certain features.
 */
function add_post_type_support($post_type, $feature, ...$args)
{
    global $_wp_post_type_features;
    $features = (array) $feature;
    foreach ($features as $feature) {
        if ($args) {
            $_wp_post_type_features[$post_type][$feature] = $args;
        } else {
            $_wp_post_type_features[$post_type][$feature] = true;
        }
    }
}

WordPress Version: 4.3

/**
 * Register support of certain features for a post type.
 *
 * 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.
 *
 * @since 3.0.0
 *
 * @global array $_wp_post_type_features
 *
 * @param string       $post_type The post type for which to add the feature.
 * @param string|array $feature   The feature being added, accepts an array of
 *                                feature strings or a single string.
 */
function add_post_type_support($post_type, $feature)
{
    global $_wp_post_type_features;
    $features = (array) $feature;
    foreach ($features as $feature) {
        if (func_num_args() == 2) {
            $_wp_post_type_features[$post_type][$feature] = true;
        } else {
            $_wp_post_type_features[$post_type][$feature] = array_slice(func_get_args(), 2);
        }
    }
}

WordPress Version: 4.0

/**
 * Register support of certain features for a post type.
 *
 * 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.
 *
 * @since 3.0.0
 *
 * @param string       $post_type The post type for which to add the feature.
 * @param string|array $feature   The feature being added, accepts an array of
 *                                feature strings or a single string.
 */
function add_post_type_support($post_type, $feature)
{
    global $_wp_post_type_features;
    $features = (array) $feature;
    foreach ($features as $feature) {
        if (func_num_args() == 2) {
            $_wp_post_type_features[$post_type][$feature] = true;
        } else {
            $_wp_post_type_features[$post_type][$feature] = array_slice(func_get_args(), 2);
        }
    }
}

WordPress Version: 3.9

/**
 * Register support of certain features for a post type.
 *
 * 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.
 *
 * @since 3.0.0
 *
 * @param string       $post_type The post type for which to add the feature.
 * @param string|array $feature   The feature being added, accpets an array of
 *                                feature strings or a single string.
 */
function add_post_type_support($post_type, $feature)
{
    global $_wp_post_type_features;
    $features = (array) $feature;
    foreach ($features as $feature) {
        if (func_num_args() == 2) {
            $_wp_post_type_features[$post_type][$feature] = true;
        } else {
            $_wp_post_type_features[$post_type][$feature] = array_slice(func_get_args(), 2);
        }
    }
}

WordPress Version: 3.7

/**
 * Register support of certain features for a post type.
 *
 * All features are directly associated with a functional area of the edit screen, such as the
 * editor or a meta box: 'title', 'editor', 'comments', 'revisions', 'trackbacks', 'author',
 * 'excerpt', 'page-attributes', 'thumbnail', and 'custom-fields'.
 *
 * 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.
 *
 * @since 3.0.0
 * @param string $post_type The post type for which to add the feature
 * @param string|array $feature the feature being added, can be an array of feature strings or a single string
 */
function add_post_type_support($post_type, $feature)
{
    global $_wp_post_type_features;
    $features = (array) $feature;
    foreach ($features as $feature) {
        if (func_num_args() == 2) {
            $_wp_post_type_features[$post_type][$feature] = true;
        } else {
            $_wp_post_type_features[$post_type][$feature] = array_slice(func_get_args(), 2);
        }
    }
}