get_post_modified_time()
get_post_modified_time( string $format = ‘U’, bool $gmt = false, int|WP_Post $post = null, bool $translate = false )
检索上次修改帖子的时间。
Retrieve the time at which the post was last modified.
参数(Parameters)
参数 | 类型 | 必填 | 说明 |
---|---|---|---|
$format | (string) | 可选 | 用于检索邮件修改时间的格式。“G”、“U”或PHP日期格式。 |
$gmt | (bool) | 可选 | 是否检索GMT时间。 |
$post | (int | WP_Post) | 可选 | WP_Post object或ID。默认值为全局$Post object。 |
$translate | (bool) | 可选 | 是否翻译时间字符串。 |
返回(Return)
(string|int|false)格式化的日期string或Unix时间戳(string|int|false)。失败时为False。
源码(Source)
更新版本 | 源码位置 | 使用 | 被使用 |
---|---|---|---|
2.0.0 | wp-includes/general-template.php:2754 | 2 | 5 |
笔记(Notes)
如果要获取WP中定义的自己语言的日期,只需将参数translate设置为true,例如:
get_post_modified_time() 为WP2原创文章,链接:https://www.wp2.cn/functions/get_post_modified_time/