This documentation describes unreleased changes on the main branch.

wp_post_date()

Twig function of the framework; its result is escaped like any value.

{{ wp_post_date(id, format = '') }}

The publication date of a post, formatted as returned by get_the_date(), as text. Returns '' if the ID is null, the post does not exist or is not publicly viewable (except when the block editor renders the block).

<time>{{ wp_post_date(attrs.target, 'j. F Y') }}</time>
ParameterTypeDefaultDescription
idint|nullrequiredID of the post, e.g. from a reference attribute.
formatstring''PHP date format; '' uses the date format of the site.

Returns string