钩子文档

get_the_modified_time

💡 云策文档标注

概述

get_the_modified_time 是一个 WordPress 过滤器,用于本地化处理文章最后修改时间的输出。它允许开发者自定义时间格式或基于文章对象调整时间显示。

关键要点

  • 过滤器名称:get_the_modified_time
  • 参数:$the_time(格式化时间或 false)、$format(时间格式字符串)、$post(WP_Post 对象或 null)
  • 用途:过滤文章最后修改时间的本地化输出,支持自定义格式和文章上下文
  • 相关函数:get_the_modified_time() 用于检索文章最后修改时间
  • 版本变更:4.6.0 版本添加了 $post 参数,2.0.0 版本引入

📄 原文内容

Filters the localized time a post was last modified.

Parameters

$the_timestring|int|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.
$postWP_Post|null
WP_Post object or null if no post is found.

Source

return apply_filters( 'get_the_modified_time', $the_time, $format, $post );

Changelog

Version Description
4.6.0 Added the $post parameter.
2.0.0 Introduced.