get_post_timestamp

SummerySummery

Retrieve post published or modified time as a Unix timestamp.

Syntax

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

DescriptionDescription

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

ParametersParameters

$post

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

Default value: null

$field

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

Default value: 'date'

ReturnReturn

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

SourceSource

File: wp-includes/general-template.php


			

ChangelogChangelog

Changelog
Version Description
5.3.0 Introduced.
Scroll to Top