Un motore di ricerca WordPress per sviluppatori e autori di temi



get_post_modified_time ›

Da2.0.0
Deprecaton/a
get_post_modified_time ( $d = 'U', $gmt = false, $post = null, $translate = false )
Parametri: (4)
  • (string) $d Optional. Format to use for retrieving the time the post was modified. Either 'G', 'U', or php date format. Default 'U'.
    Richiesto: No
    Default: 'U'
  • (bool) $gmt Optional. Whether to retrieve the GMT time. Default false.
    Richiesto: No
    Default: false
  • (int|WP_Post) $post WP_Post object or ID. Default is global $post object.
    Richiesto: No
    Default: null
  • (bool) $translate Whether to translate the time string. Default false.
    Richiesto: No
    Default: false
Ritorna:
  • (string|int|false) Formatted date string or Unix timestamp if `$d` is 'U' or 'G'. False on failure.
Definito a:
Codex:

Retrieve the time at which the post was last modified.



Sorgenti

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    Format to use for retrieving the time the post was modified.
	 *                     Accepts 'G', 'U', or php date format. Default 'U'.
	 * @param bool   $gmt  Whether to retrieve the GMT time. Default false.
	 */
	return apply_filters( 'get_post_modified_time', $time, $d, $gmt );
}