WordPress获取文章状态函数:get_post_status - 利剑分享-科技生活-利剑分享-科技生活
利剑分享-科技生活-利剑分享-科技生活
利剑分享-科技生活

WordPress获取文章状态函数:get_post_status

WordPress获取文章状态函数:get_post_status

WordPress函数get_post_status用于获取文章的状态,比较少用到。

get_post_status( int $ID )

函数参数

$ID

整数型,默认为空

文章的ID

函数返回值

  • publish:公开的;
  • pending:待审核;
  • draft:草稿;
  • auto-draft:自动草稿;
  • future:定时;
  • private:私有的;
  • inherit:继承,子页面继承父级页面属性;
  • trash:垃圾箱;

函数使用示例

<?phpif ( get_post_status ( 28 ) == 'private' ) {echo 'private';} else {echo 'public';}?>

扩展阅读

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

相关函数:

  • get_post_statuses()

© 版权声明
THE END
喜欢就支持一下吧
点赞8 分享

Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'uos_print_tracking_script' not found or invalid function name in /www/wwwroot/flybace.com/wp-includes/class-wp-hook.php on line 324