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') }}
get_taxonomyTaxonomyTaxonomy object by slug — for accessing labels{{ get_taxonomy('category').label }}

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') }}

Taxonomy Lookup

get_taxonomy(slug) returns the WordPress taxonomy object — useful when you have a taxonomy slug (e.g. from term.taxonomy) and need the human-readable label or other taxonomy info:

{{ get_taxonomy('category').label }}                    <!-- 'Categories' -->
{{ get_taxonomy('category').labels.singular_name }} <!-- 'Category' -->
{{ get_taxonomy(term.taxonomy).label }} <!-- Label for the current term's taxonomy -->
{{ get_taxonomy('product_cat').hierarchical }}

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'}) }}

Default limits when not specified:

  • get_posts — 10 posts (posts_per_page: 10)
  • get_terms — 10 terms (number: 10)
  • get_users — 10 users (number: 10)
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.