get_lastpostmodified
apply_filters( ‘get_lastpostmodified’, string|false $lastpostmodified , string $timezone )
过滤钩子:过滤最近一次修改帖子的时间。
Filter Hook: Filters the most recent time that a post was modified.
参数(Parameters)
参数 | 类型 | 说明 |
---|---|---|
$lastpostmodified | (string | false) | 最近一次以“Y-m-d H:i:s”格式修改帖子。失败时为False。 |
$timezone | (string) | 用于获取后期修改日期的位置。有关接受的$timezone值,请参见get_lastpostdate()。 |
源码(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 ); }
更新版本 | 源码位置 | 使用 | 被使用 |
---|---|---|---|
2.3.0 | wp-includes/post.php:6492 | 1 | 0 |
get_lastpostmodified 为WP2原创文章,链接:https://www.wp2.cn/hook/get_lastpostmodified-2/