Skip to content

Adding dynamic tags ​

Bind a block ​

Select a block, such as a Paragraph, Heading, Button or Image, and click Dynamic tags in its toolbar. You can also Alt+click the block (Option+click on a Mac).

The Select dynamic tag picker lists everything you can bind, in groups:

GroupReads from
PostThe entry being shown: its title, excerpt, featured image, link and dates, its VX fields, and the terms assigned to it
AuthorThe entry's author
UserThe person viewing the page
TermThe current term, on a term archive or term template
SiteThe site's name, tagline and address

The Site group also lists option page values.

Pick a field. If the block has more than one part you can bind, such as a button's text and its link, Bind to chooses which part.

Relations are expandable in the picker: open a related entry to reach its fields, then one level further.

Combine and format values ​

The picker's Advanced editor lets you write an expression instead of a single field: mix text with values ("Open until @post(closing_time)"), set a fallback, or format the value with modifiers, for example to format a date or shorten a description. See VX Script.

Which blocks can be bound ​

Most blocks that show text, links or media: paragraphs, headings, buttons, list items, quote citations, images, covers, media & text, files, videos, audio and embeds. VX also makes sure a bound image or video updates its dimensions and other details, not just its address.

Galleries and tables hold lists, not single values. To show a list, loop a block over it instead.

Editing a bound value in place ​

When a block is bound to exactly one field of the current post, with no extra text or modifiers, like @post(tagline), you can edit it directly in the canvas and the field updates. Anything more complex shows a preview you can't type into.

This also works when the field is bound in the entry's template rather than in its content, for example a page's hero_lead bound in front-page. Edit the entry with its template shown (Show template in the editor, or a page opened in the Site Editor), click the bound text and type. Saving updates the entry's field; the template is never changed. In the template, a block can be typed into only when everything you could edit in it is bound to such a field, so a button whose text is bound but whose link isn't stays locked. Blocks in template parts, Query Loops and data loops stay locked too.

When you edit a template itself in the Site Editor, or look at Query Loop previews, bound values are never editable, since you're looking at sample content.

How values are displayed ​

  • Text in paragraphs, headings and button labels is inserted as HTML. A Rich text field keeps its formatting, and a line break in a plain text field becomes a line break on the page. WordPress removes anything unsafe, such as scripts.
  • Links, image addresses and alt text are inserted as safely escaped attributes.
  • Code, Preformatted and Poetry blocks show the value exactly as stored. Bind a Code field to a Code block and <div> appears as <div>, not as HTML.

When a button's link is bound, the button also gets Open in new tab and Mark as nofollow options.

Warning

Because text is inserted as HTML, a plain text value that contains < may lose part of its text, and a field filled in by site visitors (for example through a submission form) could add links or images to your page. Add the strip_tags() modifier to bindings of fields you don't fully control.

Bindings publish what you bind ​

A dynamic tag shows its value to every visitor who can see the page. If you bind a field to a public template, its value is public. This includes the address of a file uploaded with private uploads.

Bindings don't apply the REST API access levels, which only control what apps can read over the API.

Who can use dynamic tags ​

Anyone who can edit the post can add and change bindings, and in the Site Editor, anyone who can edit the theme. Previewing an option page value in the editor also requires that page's capability; the published page shows it to everyone.

Technical details for LLMs
  • Stored binding (core block bindings, source vx-framework/dynamic-data, labeled VX Dynamic Data):
    json
    { "metadata": { "bindings": { "content": { "source": "vx-framework/dynamic-data", "args": { "expression": "@post(tagline)" } } } } }
  • Bindable attributes come from the block registry (content-role string attributes) plus overrides: core/image (url, alt, …), core/cover (url), core/file (href), core/embed (url), video, audio, media-text, accordion heading handlers that sync dependent attributes. Adjust with vxframework/dynamic-data/supported-blocks and vxframework/dynamic-data/block-overrides.
  • Text-content sinks go through wp_kses_post after splicing; attribute sinks are escaped (esc_url for URLs); Code / Preformatted / Poetry are htmlspecialchars-escaped with line breaks kept.
  • Post group core paths: title, excerpt, slug, date, modified_date, permalink, id, status, post_type, edit_url, featured_image, plus field keys and assigned taxonomies as @post(<taxonomy>.name). Top-level Taxonomy fields aren't listed as post paths; use the taxonomy folder. Term: name, slug, description, url, count, id, parent. Site: name, tagline, url, admin_email, language.
  • Relations expand two levels deep. Password fields have no paths.
  • Typing in place is allowed when the source's canUserEditValue passes: a single @post(<field>) of the edited post, top-level, of an inline-editable type (Text, Textarea, Email, Phone, URL, Number). In rendering mode template-locked, VX gives a template block the contentOnly editing mode when every content-role attribute is bound to such a field, it has no inner blocks, and it isn't inside core/post-content, a template part, a synced pattern, a Query Loop (core/query, core/post-template, core/terms-query, core/term-template) or a VX loop. Writes go through setValues to the post's meta (editEntityRecord), so only the post is dirty.
  • Option page values are Site paths: <page_key>.<field_key>. Area exposes derived metrics only.
  • Dynamic data never consults REST access tiers.
  • A private-upload media URL resolves in a tag.
  • Evaluate server-side: vx-framework/evaluate-expression; catalog of paths: vx-framework/get-dynamic-data-catalog. Editor previews use vx-framework/v1/dynamic-data/evaluate and evaluate/batch with unsaved-value overlays.

Documentation for the VX Framework.