5ucms论坛

标题: wp_is_post_revision() 通过id判断一篇文章是否为修订版本类型 [打印本页]

作者: admin    时间: 2021-5-29 19:30
标题: wp_is_post_revision() 通过id判断一篇文章是否为修订版本类型
描述:
通过id判断一篇文章是否为修订版本类型

用法:
  1. <?php wp_is_post_revision( $post_id ); ?>
复制代码

参数:
$post_id (int|object) (必填) 文章ID 默认值: None


源文件:
  1. /**
  2. * Determines if the specified post is a revision.
  3. *
  4. * @since 2.6.0
  5. *
  6. * @param int|WP_Post $post Post ID or post object.
  7. * @return false|int False if not a revision, ID of revision's parent otherwise.
  8. */
  9. function wp_is_post_revision( $post ) {
  10.         if ( !$post = wp_get_post_revision( $post ) )
  11.                 return false;

  12.         return (int) $post->post_parent;
  13. }
复制代码





欢迎光临 5ucms论坛 (http://bbs.5ucms.com/) Powered by Discuz! X3.2