Uma área de pesquisa sobre o WordPress para devs e autores do tema



add_post_type_support ›

Desde3.0.0
Obsoleton/a
add_post_type_support ( $post_type, $feature, $args )
Parâmetros: (3)
  • (string) $post_type The post type for which to add the feature.
    Required: Yes
  • (string|array) $feature The feature being added, accepts an array of feature strings or a single string.
    Required: Yes
  • (mixed) $args ...$args Optional extra arguments to pass along with certain features.
    Required: Yes
Definido em:
Codex:

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.

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',
) );


Fonte

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;
		}
	}
}