This documentation describes unreleased changes on the main branch.

wp_post_url()

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

{{ wp_post_url(id) }}

The URL of a post, page or entry of another post type, as returned by get_permalink(). Returns '' if the ID is null, the post does not exist or is not publicly viewable (except when the block editor renders the block).

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

Returns string