Uma área de pesquisa sobre o WordPress para devs e autores do tema



get_post_timestamp ›

Desde5.3.0
Obsoleton/a
get_post_timestamp ( $post = null, $field = 'date' )
Parâmetros: (2)
  • (int|WP_Post) $post Optional. WP_Post object or ID. Default is global `$post` object.
    Required: No
    Padrão: null
  • (string) $field Optional. Post field to use. Accepts 'date' or 'modified'.
    Required: No
    Padrão: 'date'
Retorna:
  • (int|false) Unix timestamp on success, false on failure.
Definido em:
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.



Fonte

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

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

	return $datetime->getTimestamp();
}