注册对帖子类型的某些功能的支持。
原型
add_post_type_support( string $post_type, string|array $feature )
描述
所有核心功能都直接与编辑屏幕的功能区域相关联,例如编辑器或元框。功能包括:‘标题’,‘编辑’,‘评论’,‘修订’,‘引用’,‘作者’,‘摘录’,‘页面属性’,‘缩略图’,‘自定义字段’和’发布 – 格式。
参数
$post_type
(string)
(Required)
要为其添加功能的帖子类型。
$feature
(string|array)
(Required)
要添加的功能,接受一系列要素字符串或单个字符串。
源文件
路径:wp-includes/post.php
<?php
...
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 );
}
}
...
?>
其他
英文文档:https://developer.wordpress.org/reference/functions/add_post_type_support/