1. 首页
  2. WordPress钩子手册

get_the_modified_time

apply_filters( ‘get_the_modified_time’, string|bool $the_time, string $format, WP_Post|null $post )

过滤器::过滤上次修改帖子的本地化时间。
Filter Hook: Filters the localized time a post was last modified.

目录锚点:#参数#源码


参数(Parameters)

参数 类型 说明
$the_time (string | bool) 格式化的时间,如果找不到post,则为false。
$format (string) 用于检索邮件写入时间的格式。接受“G”、“U”或PHP日期格式。默认为“时间格式”选项中指定的值。
$post (WP_Post | null) WP_Post对象,如果找不到Post,则为空。

源码(Source)

/**
 * Retrieve the time at which the post was last modified.
 *
 * @since 2.0.0
 *
 * @param string $d Optional Either 'G', 'U', or php date format defaults to the value specified in the time_format option.
 * @return string
 */
function get_the_modified_time($d = '') {
	if ( '' == $d )
		$the_time = get_post_modified_time(get_option('time_format'), null, null, true);
	else
		$the_time = get_post_modified_time($d, null, null, true);

	/**
	 * Filter the localized time a post was last modified.
	 *
	 * @since 2.0.0
	 *
	 * @param string $the_time The formatted time.
	 * @param string $d        Format to use for retrieving the time the post was
	 *                         written. Accepts 'G', 'U', or php date format. Defaults
	 *                         to value specified in 'time_format' option.
	 */
	return apply_filters( 'get_the_modified_time', $the_time, $d );
}
更新版本 源码位置 使用 被使用
4.6.0 wp-includes/general-template.php:2738 1 0

get_the_modified_time 为WP2原创文章,链接:https://www.wp2.cn/hook/get_the_modified_time-2/