wordpress获取文章类型函数:get_post_type()

<?php
get_post_type( $post );
?>

说明

该函数可以根据文章对象或id返回文章类型字符串

参数

$post

(可选)

默认值:false,

可选值:文章对象或文章id

返回值

(bool|String)

获取出错时返回false

否则返回对应类型字符串

使用实例

返回文章id20的文章类型

<?php 
$post_type =get_post_type(20);
echo $post_type;
?>

返回值

post

© 版权声明
THE END
喜欢就支持一下吧
分享
评论 抢沙发

请登录后发表评论

    暂无评论内容