Un motore di ricerca WordPress per sviluppatori e autori di temi



get_post_timestamp ›

Da5.3.0
Deprecaton/a
get_post_timestamp ( $post = null, $field = 'date' )
Parametri: (2)
  • (int|WP_Post) $post Optional. WP_Post object or ID. Default is global `$post` object.
    Richiesto: No
    Default: null
  • (string) $field Optional. Post field to use. Accepts 'date' or 'modified'.
    Richiesto: No
    Default: 'date'
Ritorna:
  • (int|false) Unix timestamp on success, false on failure.
Definito a:
Codex:

Retrieve post published or modified time as a Unix timestamp.

Note that this function returns a true Unix timestamp, not summed with timezone offset like older WP functions.



Sorgenti

function get_post_timestamp( $post = null, $field = 'date' ) {
	$datetime = get_post_datetime( $post, $field );

	if ( false === $datetime ) {
		return false;
	}

	return $datetime->getTimestamp();
}