^ 回到顶部
  • 人生没有定律,每个人都有自己的节奏
  • 本站wordpress建站教程均通过实践后发布,希望对你有帮助
  • 希望你的坚持,都是因为热爱,而不是因为不甘心
  • 8年wordpress建站经验,5星服务品质
  • 那些不愿意让你吃亏的人,才是真正值得你深交的人,也是值得你付出时间的人
  • 阿里云2核2g仅需86元/年

wordpress函数get_the_modified_time()用法示例

get_the_modified_time( string $d = '',  int|WP_Post $post = null )

Retrieve the time at which the post was last modified.


描述


参数

$d

(string)
(Optional)
Format to use for retrieving the time the post was modified. Either 'G', 'U', or php date format defaults to the value specified in the time_format option.

新用户2核2g仅需86元/年    领取1153套模板    免费cdn流量包    ¥3188礼包

Default value: ''

$post

(int|WP_Post)
(Optional)
Post ID or WP_Post object. Default current post.

Default value: null


返回值

(false|string) Formatted date string or Unix timestamp. False on failure.


源代码

File: wp-includes/general-template.php

function get_the_modified_time( $d = '', $post = null ) {
	$post = get_post( $post );

	if ( ! $post ) {
		// For backward compatibility, failures go through the filter below.
		$the_time = false;
	} elseif ( empty( $d ) ) {
		$the_time = get_post_modified_time( get_option( 'time_format' ), false, $post, true );
	} else {
		$the_time = get_post_modified_time( $d, false, $post, true );
	}

	/**
	 * Filters the localized time a post was last modified.
	 *
	 * @since 2.0.0
	 * @since 4.6.0 Added the `$post` parameter.
	 *
	 * @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.
	 * @param WP_Post $post    WP_Post object.
	 */
	return apply_filters( 'get_the_modified_time', $the_time, $d, $post );
}

更新日志

Version 描述
4.6.0 Added the $post parameter.
2.0.0 Introduced.

相关函数

Uses

  • wp-includes/general-template.php:
    get_post_modified_time()
  • wp-includes/general-template.php:
    get_the_modified_time
  • wp-includes/plugin.php:
    apply_filters()
  • wp-includes/option.php:
    get_option()
  • wp-includes/post.php:
    get_post()

Used By

  • wp-includes/general-template.php:
    the_modified_time()

让小雨知道,这篇文章帮到了你
扫码关注微信公众号zs40086(微搜片)随时随地微信看片,抢先福利电影等你来

热门推荐

如有疑问,请前往问答中心反馈!

反馈