wp_post_title()

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

{{ wp_post_title(id) }}

The title of a post, page or entry of another post type (its post_title), 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).

<h2>{{ wp_post_title(attrs.target) }}</h2>
ParameterTypeDefaultDescription
idint|nullrequiredID of the post, e.g. from a reference attribute.

Returns string