Skip to main content

WordPress Functions

These functions retrieve WordPress objects and return full provider objects, so you can chain property access.

FunctionReturnsDescriptionExample
get_postPostSingle post by ID{{ get_post(42).title }}
get_postsCollectionPosts by query args{{ get_posts({post_type: 'page'}) }}
get_termTermSingle term by ID{{ get_term(5).name }}
get_termsCollectionTerms by query args{{ get_terms({taxonomy: 'category'}) }}
get_userUserSingle user by ID{{ get_user(1).display_name }}
get_usersCollectionUsers by query args{{ get_users({role: 'author'}) }}
get_imageImageSingle image by ID{{ get_image(100).src('medium') }}

Single Object Functions

Retrieve a specific object by ID and access any of its fields:

{{ get_post(42).title }}
{{ get_post(42).date('F j, Y') }}
{{ get_term(3).name }}
{{ get_term(3).link }}
{{ get_user(1).display_name }}
{{ get_user(1).avatar(96) }}
{{ get_image(thumbnail_id).src('medium') }}

Collection Functions

Retrieve multiple objects using query arguments. Returns a collection that can be iterated in a Loop or accessed directly:

{{ get_posts({post_type: 'page', posts_per_page: 5}) }}
{{ get_terms({taxonomy: 'category', hide_empty: true}) }}
{{ get_users({role: 'author'}) }}

Collection results also expose query metadata:

{{ get_posts({post_type: 'post'}).found_posts }}
Security

WordPress functions enforce security: viewable post types only, permission checks on non-public statuses, MIME type validation for images, and capability-based field restrictions.