_wp_get_post_revision_version() - WordPress 函数参考中文文档

返回介绍

_wp_get_post_revision_version()

发布于 2017-09-11 字数 1455 浏览 893 评论 0

Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

_wp_get_post_revision_version( WP_Post $revision )

Gets the post revision version.


描述


参数

$revision

(WP_Post)
(Required)


返回值

(int|false)


源代码

File: wp-includes/revision.php

function _wp_get_post_revision_version( $revision ) {
	if ( is_object( $revision ) )
		$revision = get_object_vars( $revision );
	elseif ( !is_array( $revision ) )
		return false;

	if ( preg_match( '/^\d+-(?:autosave|revision)-v(\d+)$/', $revision['post_name'], $matches ) )
		return (int) $matches[1];

	return 0;
}

更新日志

Version 描述
3.6.0 Introduced.

相关函数

Used By

  • wp-admin/includes/post.php:
    edit_post()
  • wp-includes/revision.php:
    _wp_upgrade_revisions_of_post()

User Contributed Notes

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

目前还没有任何评论,快来抢沙发吧!