Skip to main content

Dynamic Data Keys

This page will serve as the master doc page for all dynamic data keys. Feel free to bookmark it.

Available Keys

  • Templates use this.key.
  • Taxonomies use taxonomy.key and term.key.
  • Loops use item.key by default (but you control the key).
KeyDescription
idThe unique identifier for the item (post, page, etc).
titleThe title of the item.
slugThe URL-friendly slug for the item.
contentThe main content/body of the item.
excerptThe summary or excerpt of the item.
permalink.relativeThe relative permalink (URL path) to the item (e.g., /blog/my-post).
permalink.fullThe full absolute permalink (URL) to the item (e.g., https://site.com/blog/my-post).
imageAll image object data (two examples of use below).
image.urlThe URL to the image.
image.altThe image's alt text.
dateThe publish date of the item.
modifiedThe last modified date of the item.
statusThe status of the item (e.g., publish, draft).
typeThe post type (e.g., post, page, product).
thumbnailThe URL of the thumbnail image for the item.
authorThe author object for the item.
author.idThe unique identifier for the author.
author.nameThe display name of the author.
templateThe template object assigned to the item.
template.slugThe slug of the template.
template.idThe unique identifier for the template.
template.titleThe title of the template.
readingTimeThe estimated reading time in minutes based on content word count (200 words/min).
post_authorThe unique identifier for the author.
post_dateThe publish date of the item.
post_date_gmtThe publish date of the item.
post_contentThe main content/body of the item.
post_titleThe title of the item.
post_excerptThe summary or excerpt of the item.
post_statusThe status of the item (e.g., publish, draft).
comment_statusThe status for comments (e.g., open, closed).
ping_statusThe ping stauts of the item (e.g., open, closed).
post_passwordThe items's password.
post_nameThe URL-friendly slug for the item.
to_pingURLs queued to be pinged.
pingedURLs that have been pinged.
post_modifiedThe modified date of the item.
post_modified_gmtThe modified date of the item.
guidThe GUID of the item.
menu_orderThe menu order of the item.
post_typeThe post type (e.g., post, page, product).
post_mime_typeThe mime type of attachment item.
post_parentThe ID of a post's parent post.
comment_countThe total of comments for the item.

User Keys

KeyDescription
userThe user object for the current user.
user.idThe unique identifier for the user.
user.loginThe username/login of the user.
user.emailThe email address of the user.
user.displayNameThe display name of the user.
user.firstNameThe first name of the user.
user.lastNameThe last name of the user.
user.nicknameThe nickname of the user.
user.fullNameThe full name of the user (first + last).
user.descriptionThe biographical description of the user.
user.userUrlThe website URL of the user.
user.avatarThe URL of the user's avatar image.
user.registeredThe registration date of the user.
user.userRolesArray of all roles assigned to the user.
user.userRoleThe primary role of the user (first role in the array).
user.capabilitiesThe capabilities/permissions of the user.
user.loggedInWhether the user is currently logged in (boolean).

Site Keys

KeyDescription
site.nameThe site name/title.
site.descriptionThe site tagline/description.
site.home_urlThe home URL of the site.
site.urlThe site URL.
site.versionThe WordPress version.
site.languageThe site language code.
site.isMultisiteWhether the site is part of a multisite network (boolean).
site.currentDateReferences the current date. Is returned as a unix timestamp.

Options Keys

The options key provides access to global site options configured via options pages. These values are available everywhere (pages, templates, loops, headers/footers, etc.).

For up-to-date integrations, namespaces, and scoping patterns, see the Options Pages documentation. It covers:

  • Which integrations are currently supported.
  • The required namespace for each integration (e.g., acf, metabox, jetengine).
  • Integration-specific syntax (for example, Meta Box requiring a option page name: options.metabox.option_page_name.field_name).

Notes

  • Requires an Options Page created in the integration plugin.
  • Keys resolve globally; no post context is required.

URL Keys

KeyDescription
url.fullThe current full URL of the page.
url.relativeThe relative path portion of the current URL.
url.parameterThe URL parameters/query string of the current page.

url.parameter allows you to reference the value of any parameter key in the url string, which can be very helpful for personalizing page content by injecting content or creating conditions.

For example, if you have a URL of /thank-you/?firstName=John, you can use {url.parameter.firstName} to output John.

For security, all URL parameters are automatically sanitized using WordPress's sanitize_text_field() function to prevent XSS attacks.

tip

This key is case sensitive. If you have a parameter of Name in your URL, you need to use {url.parameter.Name}, not {url.parameter.name}

Etch Custom Fields Support

Custom fields created within Etch can be accessed with the etch extension.

For example, item.etch.field_id in a loop or this.etch.field_id in a template.

Generic Meta Field Support

Custom fields registered to WordPress can be accessed with the meta extension.

For example, item.meta.field_id in a loop or this.meta.field_id in a template.

Third-Party Custom Fields

Etch integrates with third-party custom field solutions like Advanced Custom Fields (ACF).

For detailed information on working with third-party custom fields, see the Custom Fields section in Integrations.

Custom Integration

Etch allows you to extend Dynamic Data through filter hooks. This way, all main keys (post, user, term, and options) can be extended.

Tips for Working with Dynamic Data

  • Not all keys are available for every item type. Availability depends on the context (e.g., posts, pages, custom post types).

    • Use the Loop Manager (or just output {this} on the page/template) to view the data available for the the post type you are working with. This will show the full JSON object for the item in question, which can be helpful for understanding what data is available.
  • Some keys output the data directly (e.g., {item.title}, {this.content}, etc). If your key outputs a string, you can use it directly in your page or template.

  • Some keys are objects (e.g., author, template). These are inside of curly braces {}. If your key outputs an object, you need to drill down to a sub-key (e.g., {item.author.name}, {this.template.slug) to get to the data you're looking for.

  • Some object keys contain special characters (spaces, dashes, etc.) that don't work with dot notation. For these cases, you can use bracket notation with quotes:

    • Keys with spaces: {item["full name"]}

    • Keys with dashes: {item["post-meta"]}

    • Keys with underscores: {this.acf_field} or {item["custom_value"]}

    • Keys with numbers: {item[0]} (for arrays)

      Examples:

    • {this["page title"]} - Access a key with spaces

    • {item["author-info"]["email"]} - Nested keys with dashes

    • {this.categories[0].name} - Mix dot and bracket notation

    • {item["users"][0]["display-name"]} - Multiple bracket notations

    You can also use single quotes: {item['full name']} works the same as {item["full name"]}

  • Some keys are arrays (e.g., categories, tags). These are inside of square brackets []. If your key outputs an array, you can {#loop} through it or access a specific item by index (e.g., {this.categories.at(0).name}). See the Accessing Data in Arrays section below for more information.

  • If you want to output curly braces ({ and }) without the dynamic data engine interpreting them, you can do so by adding them as a separate string inside the dynamic expression. For example: {"{This will be output as is}"}

Accessing Data in Arrays

Some dynamic data keys return arrays (for example, categories, tags, etc). You can work with these arrays in two common ways:

1) Loop through the items

  • Create a loop that returns the array items you want to render, then output each item’s fields.

Example: Loop categories for the current post:

{#loop categories as category}
<span>{category.name}</span>
{/loop}

2) Access a specific item by index (zero-based)

You can use either dot notation with the .at() modifier or bracket notation to access a specific item:

Dot notation (using .at() modifier):

{this.categories.at(0).name}

Bracket notation (direct array access):

{this.categories[0].name}

Both approaches are equivalent. Continue using dot notation for simple property names (e.g., {this.title}, {item.name}). Use bracket notation only when needed for properties with special characters or spaces (e.g., {this["author-name"]}, {item["full name"]}).

info

We've updated the syntax to align with standard JavaScript and PHP conventions. Bracket notation is now available as an option for properties with special characters or spaces. Aligning with industry standards allows us to extend the functionality of dynamic data even further and will make it possible to add support for advanced features like mathematical operations in the future. The "old" syntax (dashes/spaces in dot notation) will no longer be supported, but standard dot notation like {this.title} remains unchanged and is the recommended approach for regular property names.

Notes:

  • Indexing is zero-based (0 is the first item, 1 is the second, etc.).
  • It is possible to get the last item with -1, or the second to last item with -2 and so on.
  • Ensure the array and the requested index exist before using them (e.g., a post may have no categories).