Post
Access current post data. Available on single post/page views and inside Loop blocks (via the loop data alias).
All Fields
| Field | Arguments | Returns | Description |
|---|---|---|---|
id | — | int | Post ID |
title | — | string | Post title |
name | — | string | Post name (alias for slug) |
slug | — | string | Post slug |
status | — | string | Post status |
format | — | string | Post format |
excerpt | {options} | string | Post excerpt |
content | page, len, remove_blocks | string | Post content (filtered) |
paged_content | — | string | Current page content (for paginated posts) |
link | — | string | Permalink URL |
path | — | string | URL path only |
edit_link | — | string | Admin edit URL |
date | format | string | Publish date |
time | format | string | Publish time |
timestamp | — | int | Unix timestamp |
modified_date | format | string | Last modified date |
modified_time | format | string | Last modified time |
modified_timestamp | — | int | Modified unix timestamp |
author | — | User | Post author |
modified_author | — | User | Last editor |
thumbnail | — | Image | Featured image |
thumbnail_id | — | int | Featured image ID |
category | — | Term | Primary category |
categories | — | array | All categories |
tags | — | array | All tags |
terms | taxonomy, options | array | Terms from taxonomy |
has_term | term, taxonomy | bool | Check if has term |
type | — | object | Post type object |
parent | — | Post | Parent post |
ancestors | — | array | Ancestor posts |
children | post_type | array | Child posts |
next | in_same_term | Post | Next post |
prev | in_same_term | Post | Previous post |
comments | count, order, type, status | array | Post comments |
comment_count | — | int | Number of comments |
can_edit | — | bool | Current user can edit |
password_required | — | bool | Password protected |
pagination | — | object | Pagination data for paginated posts |
gallery | html | mixed | Attached gallery |
post_class | class | string | CSS classes |
meta | field_name | mixed | Post meta value |
raw_meta | field_name | mixed | Unescaped meta value |
has_field | field_name | bool | Check if field exists |
Basic Fields
{{ post.id }}
{{ post.title }}
{{ post.slug }}
{{ post.status }}
Content
content
Arguments:
page— Page number for paginated content (default: 0 = all)len— Word limit (default: -1 = no limit)remove_blocks— Remove block markup (default: false)
{{ post.content }}
{{ post.content(2) }} <!-- Page 2 only -->
{{ post.content(0, 50) }} <!-- Limit to 50 words -->
{{ post.content(0, -1, true) }} <!-- Remove blocks -->
excerpt
Options object:
words— Word count (default: 50)chars— Character limit (overrides words)end— Suffix text (default:'…')force— Force from content even if excerpt exists (default: false)strip— Strip HTML tags (default: true)read_more— "Read more" link text (default: none)the_content— Use full WordPress excerpt filter (default: false, slower)
{{ post.excerpt }}
{{ post.excerpt({words: 25}) }}
{{ post.excerpt({chars: 150}) }}
{{ post.excerpt({words: 30, end: '...'}) }}
{{ post.excerpt({force: true}) }}
{{ post.excerpt({read_more: 'Continue reading'}) }}
{{ post.excerpt({the_content: true}) }}
URLs
{{ post.link }}
{{ post.path }}
{{ post.edit_link }}
Dates
format: PHP date format string (default: WordPress setting)
{{ post.date }} <!-- Uses WP date format -->
{{ post.date('F j, Y') }} <!-- January 15, 2024 -->
{{ post.time }} <!-- Uses WP time format -->
{{ post.time('g:i a') }} <!-- 2:30 pm -->
{{ post.timestamp }} <!-- 1705330245 -->
{{ post.modified_date('Y-m-d') }}
Author
The author field returns a User object with all user fields.
{{ post.author.name }}
{{ post.author.avatar }}
{{ post.modified_author.name }}
tip
post.author is also available as the root author variable. See User & Author for details.
Featured Image
The thumbnail field returns an Image object.
{{ post.thumbnail.src }}
{{ post.thumbnail.src('medium') }}
{{ post.thumbnail.alt }}
{{ post.thumbnail.width }}
{{ post.thumbnail_id }}
Taxonomies
terms
Arguments:
taxonomy— Taxonomy name, array of names, or'all'(default:'all')options—{merge: true}to combine or{merge: false}to group by taxonomy
{{ post.terms('genre') }}
{{ post.terms(['category', 'post_tag']) }}
{{ post.terms('all') }}
{{ post.terms('category', {merge: false}) }}
has_term
Arguments:
term— Term name, slug, or IDtaxonomy— Taxonomy name (default:'all')
{{ post.has_term('news') }}
{{ post.has_term('news', 'category') }}
{{ post.has_term(5, 'category') }}
Hierarchy
children
Arguments:
post_type— Post type to get,'parent'for same type, or query array (default:'any')
{{ post.children }}
{{ post.children('page') }}
{{ post.children('parent') }}
{{ post.children({post_type: 'page', orderby: 'title'}) }}
next / prev
Arguments:
in_same_term— Stay in same taxonomy term.true,false, or taxonomy name (default: false)
{{ post.next }}
{{ post.next(true) }} <!-- Same category -->
{{ post.next('genre') }} <!-- Same genre term -->
{{ post.prev }}
{{ post.prev(true) }}
Comments
comments
Arguments:
count— Number of comments (default: all)order—'ASC','DESC', or'wp'for WP setting (default:'wp')type— Comment type (default:'comment')status— Comment status (default:'approve')
{{ post.comments }}
{{ post.comments(5) }} <!-- Latest 5 -->
{{ post.comments(10, 'DESC') }} <!-- Latest 10, newest first -->
{{ post.comment_count }}
Other Fields
gallery
Arguments:
html— Return HTML galleries (default: true)
{{ post.gallery }}
{{ post.gallery(false) }} <!-- Return data only -->
post_class
Arguments:
class— Extra class(es) to add
{{ post.post_class }}
{{ post.post_class('custom-class') }}
Custom Fields (Meta)
{{ post.meta('price') }}
{{ post.meta('event_date') }}
{{ post.meta('address').city }}
{{ post.has_field('custom_field') }}
Note: Private meta keys (starting with _) are blocked for security.
Common Patterns
Post card
{{ post.title }}
{{ post.excerpt({words: 25}) }}
{{ post.date('F j, Y') }}
{{ post.author.name }}
{{ post.thumbnail.src('medium') }}
Custom field with fallback
{{ post.meta('custom_title') ?? post.title }}
{{ post.meta('custom_excerpt') ?? post.excerpt }}
Post navigation
{{ post.prev.title ?? '' }}
{{ post.next.title ?? '' }}
Taxonomy list
{{ post.categories|map(c => c.name)|join(', ') }}
{{ post.tags|map(t => t.name)|join(', ') }}
Conditional featured image
{{ post.thumbnail ? post.thumbnail.src('large') : '/default.jpg' }}
{{ post.thumbnail.alt ?? post.title }}