the_modified_time
云策文档标注
概述
the_modified_time 是一个 WordPress 过滤器,用于本地化显示文章最后修改时间。它允许开发者自定义时间格式或修改输出内容。
关键要点
- 过滤器名称:the_modified_time
- 参数:接受两个参数,第一个是格式化后的时间字符串或 false(如果未找到文章),第二个是时间格式字符串,支持 'G'、'U' 或 PHP 日期格式。
- 用途:主要用于在主题或插件中过滤文章最后修改时间的显示输出。
代码示例
echo apply_filters( 'the_modified_time', get_the_modified_time( $format ), $format );注意事项
- 此过滤器自 WordPress 2.0.0 版本引入。
- 相关函数 the_modified_time() 用于直接显示文章最后修改时间。
原文内容
Filters the localized time a post was last modified, for display.
Parameters
$get_the_modified_timestring|false-
The formatted time or false if no post is found.
$formatstring-
Format to use for retrieving the time the post was modified. Accepts
'G','U', or PHP date format.
Source
echo apply_filters( 'the_modified_time', get_the_modified_time( $format ), $format );
Changelog
| Version | Description |
|---|---|
| 2.0.0 | Introduced. |