1. 首页
  2. WordPress 函数手册

get_post_timestamp()

get_post_timestamp( int|WP_Post $post = null, string $field = ‘date’ )

检索发布后或修改后的时间作为Unix时间戳。
Retrieve post published or modified time as a Unix timestamp.

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


说明(Description)

注意,这个函数返回一个真正的Unix时间戳,不像以前的WP函数那样用时区偏移量求和。


参数(Parameters)

参数 类型 必填 说明
$post (int | WP_Post) 可选 WP_Post object或ID。默认值为全局$Post object。
$field (string) 可选 从数据库中发布或修改要使用的时间。接受“日期”或“已修改”。

返回(Return)

(int|false)Unix成功时的时间戳,失败时为false。


源码(Source)


更新版本 源码位置 使用 被使用
5.3.0 wp-includes/general-template.php:2670 2 1 function

get_post_timestamp() 为WP2原创文章,链接:https://www.wp2.cn/functions/get_post_timestamp/