get_lastpostmodified()

get_lastpostmodified( string $timezone = ‘server’, stri…

get_lastpostmodified( string $timezone = ‘server’, string $post_type = ‘any’ )

获取网站上的帖子被修改的最新时间。
Get the most recent time that a post on the site was modified.

目录锚点:#说明#参数#返回#源码


说明(Description)

服务器时区是默认值,是GMT和服务器时间之间的差异。“blog”值正好是最后一篇文章被修改时的值。“gmt”是在gmt时间内修改最后一个帖子的时间。


参数(Parameters)

参数 类型 必填 说明
$timezone (string) 可选 时间戳的时区。有关接受值的信息,请参见get_lastpostdate()。
$post_type (string) 可选 要检查的邮件类型。

返回(Return)

(string)“Y-m-d H:i:s”格式的时间戳,失败时为false。


源码(Source)

/**
 * Get the timestamp of the last time any post was modified.
 *
 * The server timezone is the default and is the difference between GMT and
 * server time. The 'blog' value is just when the last post was modified. The
 * 'gmt' is when the last post was modified in GMT time.
 *
 * @since 1.2.0
 *
 * @param string $timezone Optional. The timezone for the timestamp. Uses the server's internal timezone.
 *                         Accepts 'server', 'blog', 'gmt'. or 'server'. 'server' uses the server's
 *                         internal timezone. 'blog' uses the `post_modified` field, which proxies
 *                         to the timezone set for the site. 'gmt' uses the `post_modified_gmt` field.
 *                         Default 'server'.
 * @return string The timestamp.
 */
function get_lastpostmodified( $timezone = 'server' ) {
	$lastpostmodified = _get_last_post_time( $timezone, 'modified' );

	$lastpostdate = get_lastpostdate($timezone);
	if ( $lastpostdate > $lastpostmodified )
		$lastpostmodified = $lastpostdate;

	/**
	 * Filter the date the last post was modified.
	 *
	 * @since 2.3.0
	 *
	 * @param string $lastpostmodified Date the last post was modified.
	 * @param string $timezone         Location to use for getting the post modified date.
	 *                                 See {@see get_lastpostmodified()} for accepted `$timezone` values.
	 */
	return apply_filters( 'get_lastpostmodified', $lastpostmodified, $timezone );
}
更新版本 源码位置 使用 被使用
4.4.0 wp-includes/post.php:6458 2 5
类别:WordPress 函数手册

本文收集自互联网,转载请注明来源。
如有侵权,请联系 wper_net@163.com 删除。

评论 (0)COMMENT

登录 账号发表你的看法,还没有账号?立即免费 注册