add_post_type_support()
热度:85add_post_type_support( string $post_type, string|array $feature )
将值转换为非负整数。
描述:
所有核心功能都直接与编辑屏幕的功能区域相关联,例如编辑器或元框。功能包括:'标题','编辑','评论','修订','引用','作者','摘录','页面属性','缩略图','自定义字段'和'发布 - 格式。
此外,“修订”功能决定了帖子类型是否会存储修订版,而“评论”功能则指示评论计数是否会显示在编辑屏幕上。
参数:
$post_type
(string) (Required) 要添加功能的帖子类型。
$feature
(string|array) (Required) 要添加的要素,接受要素字符串数组或单个字符串。
示例:
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 );
}
}