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

wordpress函数get_post_modified_time()用法示例

get_post_modified_time( string $d = 'U',  bool $gmt = false,  int|WP_Post $post = null,  bool $translate = false )

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.

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

Default value: 'U'

$gmt

(bool)
(Optional)
Whether to retrieve the GMT time.

Default value: false

$post

(int|WP_Post)
(Optional)
WP_Post object or ID. Default is global $post object.

Default value: null

$translate

(bool)
(Optional)
Whether to translate the time string.

Default value: false


返回值

(string|int|false) Formatted date string or Unix timestamp if $id is 'U' or 'G'. False on failure.


源代码

File: wp-includes/general-template.php

function get_post_modified_time( $d = 'U', $gmt = false, $post = null, $translate = false ) {
	$post = get_post($post);

	if ( ! $post ) {
		return false;
	}

	if ( $gmt )
		$time = $post->post_modified_gmt;
	else
		$time = $post->post_modified;
	$time = mysql2date($d, $time, $translate);

	/**
	 * Filters the localized time a post was last modified.
	 *
	 * @since 2.8.0
	 *
	 * @param string $time The formatted time.
	 * @param string $d    The date format. Accepts 'G', 'U', or php date format. Default 'U'.
	 * @param bool   $gmt  Whether to return the GMT time. Default false.
	 */
	return apply_filters( 'get_post_modified_time', $time, $d, $gmt );
}

更新日志

Version 描述
2.0.0 Introduced.

相关函数

Uses

  • wp-includes/general-template.php:
    get_post_modified_time
  • wp-includes/functions.php:
    mysql2date()
  • wp-includes/plugin.php:
    apply_filters()
  • wp-includes/post.php:
    get_post()

Used By

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

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

热门推荐

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

反馈