函数原型
add_post_type_support( string $post_type, string|array $feature, mixed $args )
函数描述
Registers support of certain features for a post type.
是否弃用
未弃用
函数参数
-
$post_type
string
Required - The post type for which to add the feature.
-
$feature
string|array
Required - The feature being added, accepts an array of feature strings or a single string.
-
$args
mixed
Optional - extra arguments to pass along with certain features.
函数返回值
无
函数位置
File: wp-includes/post.php.
函数源码
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',
) );源码链接
变更日志
| Version | Description |
|---|---|
| 5.3.0 | Formalized the existing and already documented ...$args parameter by adding it to the function signature. |
| 3.0.0 | Introduced. |

