WordPress函数wp_is_post_revision()通过id判断一篇文章是否为修订版本类型

描述:

通过id判断一篇文章是否为修订版本类型

用法:

<?php wp_is_post_revision( $post ); ?>

参数:

$post

(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;
}