5ucms论坛
标题:
wp_is_post_revision() 通过id判断一篇文章是否为修订版本类型
[打印本页]
作者:
admin
时间:
2021-5-29 19:30
标题:
wp_is_post_revision() 通过id判断一篇文章是否为修订版本类型
描述:
通过id判断一篇文章是否为修订版本类型
用法:
<?php wp_is_post_revision( $post_id ); ?>
复制代码
参数:
$post_id (int|object) (必填) 文章ID 默认值: None
源文件:
/**
* Determines if the specified post is a revision.
*
* @since 2.6.0
*
* @param int|WP_Post $post Post ID or post object.
* @return false|int False if not a revision, ID of revision's parent otherwise.
*/
function wp_is_post_revision( $post ) {
if ( !$post = wp_get_post_revision( $post ) )
return false;
return (int) $post->post_parent;
}
复制代码
欢迎光临 5ucms论坛 (http://bbs.5ucms.com/)
Powered by Discuz! X3.2