Spintax

Content generation for WordPress — spintax markup bound to ACF fields, post meta and WooCommerce product descriptions.

Available on: WordPress.org GitHub
Project site →

Spintax is a content-generation toolkit for WordPress that turns one template into unique, non-duplicate copy across a whole site. Author reusable templates in spintax markup, then embed them inline through shortcodes and PHP — or bind them to ACF fields, post meta and WooCommerce product fields so every matching post gets its own rendered variant on save, on a cron schedule, or on demand.

Markup

  • Enumerations{a|b|c} picks one option at random, with nesting
  • Permutations[<config>a|b|c] picks N elements, shuffles, joins with custom separators
  • Variables%var% in global, shortcode and local scope: #set re-picks at every use, #def picks once per render
  • Conditionals{?VAR?then|else} branches on the value of a variable, {?!VAR?then} inverts it
  • Plural agreement{plural N: one|few|many} picks the correct grammatical form by count (RU/UK/BE and SR/HR/BS 3-form, EN-style 2-form)
  • Nested templates — embed one template in another via #include or [spintax]
  • Block comments/#…#/ never reaches the output

ACF and post-meta bindings

A binding pairs a template with one target field on one post type — say "Posts → ACF: hero_subtitle" — and the plugin fills that field on every matching post. Manual edits are preserved by default and tracked by hash; flags decide whether a binding seeds empty fields only, regenerates on every save, or clears the field when a template renders to nothing.

  • Bulk Apply — chunked async walks via Action Scheduler, with a synchronous "Run now" and a WP-CLI fallback when it is not installed
  • Logs — a per-walk record of what each run wrote, skipped or cleared
  • WP-CLIwp spintax bindings list|apply|test|export|import for staging → production sync
  • Migration — a one-shot wizard for users coming from nested-spintax-for-acf

WooCommerce

On a single-product page the plugin detects the current product and exposes it to templates as %product_name%, %product_sku%, %product_type%, %product_categories%, %product_tags% and one %product_attribute_<slug>% per attribute — so one template embedded on two products renders two separate cached variants. Pricing is deliberately left out: it is volatile commerce data, and folding it into templates would churn the render cache on every price change.

A product-field binding goes one step further and writes the generated copy into the product's description or short description, through the same machinery as ACF bindings — cron, Bulk Apply, WP-CLI, Logs. Three limits are deliberate: only those two fields are writable, manual edits win by default, and every write goes through WooCommerce itself, so its caches, lookup tables and save hooks stay consistent. WooCommerce is optional throughout; with it inactive the variables simply do not appear and product bindings stop writing.

Caching and privacy

Rendered output is cached through the WP Object Cache API (Redis / Memcached ready), with optional per-template cron regeneration. Everything runs on your own server — no external services, no tracking, no data leaving the site.

One syntax, five engines

The syntax is an open, documented standard. Its core is GTW-compatible — enumerations, permutations, variables, includes — extended over the years with its own primitives: value-driven conditionals, plural agreement, roll-once #def variables. Five independent engines implement it against one shared test corpus, and the full reference lives at spintax.net. For authoring away from the WordPress admin there is Spintax Studio, a free native Windows editor with two-pane live preview and inline validation.