Templates and field values
5 min read
The page template
The template is an ordinary WordPress page or post (or any public post type). Design it with the block editor or your page builder and put variables where the row's data belongs:
<h2>Welcome to {{ pseo.src.cities.name }}</h2>
<p>{{ pseo.src.cities.summary }}</p>
<p>About {{ pseo.src.cities.population | number(0) }} inhabitants live in {{ pseo.src.cities.country }}.</p>For every generated page the plugin renders the template as if it were that page:
- the content is the template's content with the variables resolved (blocks, shortcodes and your theme's template all work as usual);
- the title is the page's resolved title (see URL and title patterns), the excerpt is resolved too;
- the featured image, template file, page attributes and theme layout are the template's;
- comments and pings are closed.
Because pages are rendered on every visit, editing the template changes every generated page at once and caches are cleared automatically (see Freshness and caches).
Where variables work
Place | Works | How the value is escaped |
|---|---|---|
Text of blocks and classic content | yes | Allowed post HTML stays ( |
HTML attributes ( | yes | Plain text, quotes encoded |
Builder settings (Elementor, other builders storing JSON in post meta) | yes, see below | like attributes and text |
The URL, title, SEO title, meta description patterns | yes | Plain text |
Field values of the template | yes, see below | like text |
Example with the cell <b>bold</b><script>alert(1)</script> [gallery] {{ glb.x }}:
- in text it prints bold and the plain word
alert(1): the<script>tag is dropped, tags that WordPress does not allow in posts are removed and only their text is kept; - in an attribute it prints
bold [gallery] { { glb.x } }as plain text; [gallery]is shown literally (data cannot call shortcodes) and{{ glb.x }}is shown with spaces ({ { glb.x } }): data can never become a template.
Other variable namespaces (glb. for Global Data, sys., wp., fn. functions) work in templates as everywhere else.
Builders
The template's own CSS and scripts are loaded on generated pages for Elementor and Avada (Fusion Builder). This was built from the builders' public APIs; check a generated page on your site after installing a builder, and see Troubleshooting if styles are missing.
The template page stays public
The template is a real page, reachable at its own URL, with the raw {{ }} placeholders in it. The plugin marks the template noindex, nofollow and keeps it out of the sitemaps (core, Yoast SEO, Rank Math, All in One SEO). To hide it completely keep it a draft or private: a draft or private template still renders on generated pages. The task editor shows a warning about this ("The page template is not published (draft or private), but its content is shown publicly on every generated page.") because the template's visibility does not decide who sees the generated pages. A password-protected template shows its content on generated pages without the password; the editor warns about that too.
Field values on generated pages
If a field group applies to the template (its location rules match the template's post type or the template itself), its fields exist for generated pages too. On a generated page, reading a field of the template returns, in this order:
- a value set by hand for that page (locked),
- a value written by AI for that page (while the task still has the field in its AI brief),
- the template's own field value, with
{{ }}variables resolved.
This works everywhere a value is read on the page: the [wpmcf_field] shortcode, the WPM Field block and block bindings, wpmcf_get_field() / the_field, {{ fg.group.field }} variables and the dynamic tags of page builders. Only the template's own fields are redirected (reading another post's field is untouched).
Example with the template field headline set to Template headline for {{ pseo.src.cities.name }}:
State |
|
|---|---|
Nothing stored for the page | Template headline for Lyon |
Set by hand in the page editor | Hand set headline |
After Use default | Template headline for Lyon |
Setting values for one page
Open the page in the page editor and use Content fields. For each field you can Edit (the value is then Set by hand and locked: runs and AI never overwrite it), Write with AI (needs AI) or Use default, which removes the value so the page shows the task's value again ("The value set here is removed; the page shows the value from the task again (template, data or the next AI run).").
State labels in the editor: Default, Empty, Set by hand, Written by AI, Waiting for AI and AI failed.
Text areas accept "One item per line, or a JSON list of objects for questions, steps and similar items" where a list is expected (structured data). A value that the field does not accept (for example text in a number field) is refused: "This value is empty or not in a form this property accepts (a number, a date, a URL…). To show the default again, use “Use default”."
Editing the data of a page
The Data section of the page editor shows the source row(s) of the page. Save row writes the change to the data table ("These rows belong to the data source. A change here updates this page right away, and every other page built from the same row."). Rows of field group sources are edited on their post (Edit on its post).
Template content that is not text
- A generated page is not a post. The page that WordPress shows uses the template's post ID, so everything that reads data by post ID (terms, post meta, builder data, the featured image) reads the template's. Plugins that save data per post (comments, ratings, view counters) share the template's ID across all generated pages.
- Converting pages to real posts copies the template's meta and terms and resolves variables in them, see Converting to posts.
Still stuck? Contact support