返回介绍

get_lastpostdate()

发布于 2017-09-10 23:28:04 字数 2496 浏览 986 评论 0 收藏 0

get_lastpostdate( string $timezone = 'server',  string $post_type = 'any' )

Retrieve the date that the last post was published.


description

The server timezone is the default and is the difference between GMT and server time. The ‘blog’ value is the date when the last post was posted. The ‘gmt’ is when the last post was posted in GMT formatted date.


参数

$timezone

(string) (Optional) The timezone for the timestamp. Accepts 'server', 'blog', or 'gmt'. '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 value: 'server'

$post_type

(string) (Optional) The post type to check.

Default value: 'any'


返回值

(string) The date of the last post.


源代码

File: wp-includes/post.php

function get_lastpostdate( $timezone = 'server', $post_type = 'any' ) {
	/**
	 * Filters the date the last post was published.
	 *
	 * @since 2.3.0
	 *
	 * @param string $date     Date the last post was published.
	 * @param string $timezone Location to use for getting the post published date.
	 *                         See get_lastpostdate() for accepted `$timezone` values.
	 */
	return apply_filters( 'get_lastpostdate', _get_last_post_time( $timezone, 'date', $post_type ), $timezone );
}

更新日志

Versiondescription
4.4.0The $post_type argument was added.
0.71Introduced.

相关函数

Uses

  • wp-includes/plugin.php: apply_filters()
  • wp-includes/post.php: _get_last_post_time()
  • wp-includes/post.php: get_lastpostdate

Used By

  • wp-includes/post.php: get_lastpostmodified()

User Contributed Notes

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文