Summery Summery

Retrieve post published or modified time as a Unix timestamp.

Syntax Syntax

get_post_timestamp( int|WP_Post $post = null, string $field = 'date' )

Description Description

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

Parameters Parameters


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

Default value: null


(string) (Optional) Published or modified time to use from database. Accepts 'date' or 'modified'.

Default value: 'date'

Return Return

(int|false) Unix timestamp on success, false on failure.

Source Source

File: wp-includes/general-template.php

	return apply_filters( 'get_the_time', $the_time, $format, $post );

 * Retrieve the time at which the post was written.
 * @since 2.0.0
 * @param string      $format    Optional. Format to use for retrieving the time the post


Changelog Changelog

Version Description
5.3.0 Introduced.


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.