WordPress检查自定义文章类型编辑区功能是否支持:post_type_supports

WordPress函数post_type_supports用于检查自定义文章类型编辑区功能是否支持。

post_type_supports( string $post_type, string $feature )

函数参数

$post_type

字符串

自定义文章类型

$feature

字符串或数组

要检查的功能,例如:title、editor、comments、revisions、trackbacks、author、excerpt、page-attributes、thumbnail、custom-fields、and post-formats

函数使用示例

检查页面的编辑区是否支持评论:

if ( post_type_supports( 'post', 'comments' ) ) {
	...
}

扩展阅读

post_type_supports()函数位于:wp-includes/post.php

相关函数:

阿里云