您的当前位置:首页 > 知识博客 > wordpress建站

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

时间:2024-03-13

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

相关函数:

  • add_post_type_support()

  • remove_post_type_support()


欢迎咨询/Welcome to inquire
tel/vx:18842938855
qq:1685522781
email:1685522781@qq.com

Copyright © 2019-2024 mysql.hk


Whatsapp
Powered by RRZCMS