New7.6: Static prerendering and more

The block framework
for WordPress

The fastest way to build custom blocks. Define fields in JSON, write templates in PHP, Twig, or Blade. No build step required.

Terminal
composer require blockstudio/blockstudio

Blockstudio deeply extends the core way of building blocks. JSON definitions, PHP templates, scoped assets. Nothing more than files, ready for the agents that will build what’s next.

Custom blocks in 3 files

Define fields in block.json, render them in a template, style with CSS or SCSS. No JavaScript, no build step, no boilerplate.

1block.json
block.json
{
  "name": "starter/hero",
  "title": "Hero",
  "blockstudio": {
    "attributes": {
      "heading": { "type": "text" },
      "showCta": { "type": "toggle" },
      "background": { "type": "color" }
    }
  }
}
2index.php
index.php
<section style="background: <?= $a['background'] ?>">
  <h1><?= $a['heading'] ?></h1>

  <?php if ($a['showCta']): ?>
    <a href="/contact">Get Started</a>
  <?php endif; ?>

  <InnerBlocks />
</section>
3style.scss
style.scss
section {
  padding: 4rem 2rem;

  h1 {
    font-size: 3rem;
    font-weight: 700;
  }

  a {
    padding: .75rem 1.5rem;
    background: currentColor;
  }
}

React features, PHP templates

Native WordPress editor components like RichText and InnerBlocks, accessible directly in your PHP templates. No JavaScript, no build step.

All inside the same file

Use <RichText /> for inline editing in the block editor and static HTML on the frontend. <InnerBlocks /> handles nested child blocks, while useblockprops="true" marks the block wrapper.

Blockstudio handles the editor integration automatically. In the editor, these become real React components. On the frontend, they render as plain server-side HTML.

index.php
<div useblockprops="true" class="container">
  <RichText
    class="text-xl font-semibold"
    tag="h1"
    attribute="richtext"
    placeholder="Enter headline"
  />

  <?php if ($a['showCta']): ?>
    <a href="<?= $a['ctaUrl'] ?>">
      <?= $a['ctaLabel'] ?>
    </a>
  <?php endif; ?>

  <InnerBlocks class="mt-4 p-4 border" />
</div>

Write templates in PHP, Twig, or Blade

Use the templating language you already know. All three share the same variables, components, and features. No JavaScript required.

Same variables, any language

Access attributes via $a, block data via $b, and parent context via $c. Use flags such as $isEditor to tailor output per environment.

Use <InnerBlocks />, <RichText />, and <MediaPlaceholder /> directly in templates without writing JavaScript.

PHP
<section class="hero">
  <h1><?= $a['heading'] ?></h1>
  <p><?= $a['description'] ?></p>
  <?php if ($a['showCta']): ?>
    <a href="<?= $a['ctaUrl'] ?>"><?= $a['ctaLabel'] ?></a>
  <?php endif; ?>
  <InnerBlocks />
</section>

Full pages, defined in code

Create complete WordPress pages from template files. HTML maps to core blocks automatically. Blockstudio keeps the editor in sync.

Write HTML, get blocks

Standard elements such as <h1>, <p>, and <ul> map to core blocks automatically. Use <block> for everything else.

Define complete layouts in your codebase. Blockstudio parses the templates and creates real WordPress pages with real blocks, fully editable in the block editor.

index.php
<div>
  <h1 blockEditingMode="contentOnly">About Us</h1>
  <p>We build tools for WordPress developers.</p>
  <img src="/team.jpg" alt="Our team" />
</div>

<block name="core/columns">
  <block name="core/column">
    <h2>Our Mission</h2>
    <p>Making block development fast and simple.</p>
  </block>
  <block name="core/column">
    <block name="core/group" layout="grid">
      <h2>Our Stack</h2>
    </block>
  </block>
</block>

Automatic sync

Pages sync to WordPress on every admin load. Change your template and the editor updates.

Template locking

Lock structure while clients edit content. Ideal for landing pages and marketing sites.

Keyed blocks

Assign keys so user edits persist across template updates. Sync structure, keep content.

Version controlled

Pages live in files. Track changes in Git, deploy environments, and review them in PRs.

Reusable patterns from template files

Define block patterns as template files. Same HTML syntax as pages, registered automatically in the block inserter.

Template files, not registration code

Create a folder with pattern.json and a template file. Blockstudio registers the pattern automatically, with no register_block_pattern() boilerplate.

Patterns are inserted as real, editable blocks. Users get a starting layout they can customize while you maintain templates in version control.

index.php
<div>
  <h2>Pricing</h2>
  <p>Simple, transparent pricing.</p>
  <block name="core/columns">
    <block name="core/column">
      <h3>Starter</h3>
      <p>For small teams getting started.</p>
    </block>
    <block name="core/column">
      <h3>Pro</h3>
      <ul><li>Priority support</li><li>Custom integrations</li></ul>
    </block>
  </block>
</div>

Same syntax as pages

Standard HTML maps to core blocks; the block tag handles everything else.

Auto-registered

Drop in a template and pattern.json. Blockstudio registers it automatically.

Fully editable

Patterns are inserted as editable block content and customized per instance.

Categorized and searchable

Categories and keywords make patterns easy to find in the inserter.

Customizable element mapping

Override which block any HTML element maps to. Point standard tags like h1, p, and img to your own block types.

Remap HTML to custom blocks

By default, standard HTML maps to core WordPress blocks. Use the element_mapping filter to point any element at another block type. Every <h1> can produce your custom block instead of core/heading.

functions.php
add_filter(
  'blockstudio/parser/element_mapping',
  function ($mapping) {
    $mapping['h1']  = 'custom/heading';
    $mapping['h2']  = 'custom/heading';
    $mapping['p']   = 'custom/paragraph';
    $mapping['img'] = 'custom/image';
    return $mapping;
  }
);

Add fields to any block

Extend core blocks, third-party blocks, or your own with custom fields. Pure JSON, no templates, no code.

Custom fields, zero templates

Create a JSON file, target a block with name, and define fields. The set property maps field values directly to classes, styles, data attributes, or anything else.

No templates and no render callbacks. Blockstudio handles output automatically using the WordPress HTML Tag Processor.

extend-animation.json
{
  "name": "core/*",
  "blockstudio": {
    "extend": true,
    "attributes": {
      "animation": {
        "type": "select",
        "options": ["none", "fade", "slide"],
        "set": [{
          "attribute": "class",
          "value": "animate-{attributes.animation}"
        }]
      }
    }
  }
}

Target any block

Extend one block, a list, or an entire namespace with wildcards such as core/*.

The set property

Map field values directly to classes, styles, data attributes, or any HTML attribute.

Conditional fields

Show and hide fields based on other values with the same operators blocks use.

Full feature set

All field types, conditional logic, populated sources, and reusable properties.

26 different field types at your disposal

From basic text fields to repeaters and tabs, plus DOM-focused fields such as classes and data attributes.

Zero-config asset pipeline

SCSS compilation, ES module imports, and automatic minification, all by naming convention. No webpack, no Vite.

Name your files, Blockstudio handles the rest

Drop style.scss next to a block and it gets compiled, minified, and enqueued automatically. The same is true for script.js, with ES module support and direct npm imports.

Assets are scoped per block and loaded only when needed. Use editor.* for editor-only assets or *.inline.* to inline them in the page.

SCSS
$accent: var(--wp--preset--color--primary);

.hero {
  padding: 4rem 2rem;
  h1 { color: $accent; font-size: clamp(2rem, 5vw, 4rem); }
  &--dark { background: #0a0a0a; }
}

SCSS compilation

Write nesting, variables, and mixins. Blockstudio compiles and minifies it automatically.

ES module imports

Import npm packages directly. Blockstudio downloads and serves them locally.

Naming convention

style.scss, script.js, editor.css. Name the file and you are done.

Scoped and inlined

Assets load only when the block is present; inline them with the filename convention.

Tailwind v4, compiled in PHP

Write utility classes in templates. Blockstudio compiles them server-side via TailwindPHP with automatic file caching.

One setting, zero tooling

Set tailwind.enabled to true in blockstudio.json and write utility classes. Blockstudio compiles CSS server-side, caches it, and injects it without Node.js.

Use blockstudio/tailwind/css to define themes, utilities, and variants with Tailwind v4 CSS-first syntax. The classes field provides editor autocomplete.

functions.php
add_filter('blockstudio/tailwind/css', function ($css) {
  return $css . '
    @theme { --color-accent: #4f46e5; }
    @layer utilities {
      .container-narrow { max-width: 48rem; margin-inline: auto; }
    }
  ';
});

Server-side compilation

Every frontend request is compiled through TailwindPHP. No Node or build step.

Automatic caching

Compiled CSS is cached to disk by class set for fast repeat requests.

CSS-first config

Define themes, utilities, and variants directly with Tailwind v4 CSS.

Live editor preview

Instant editor preview while the frontend uses server-compiled CSS.

Built for developers

Power features that make complex blocks simple to build and maintain.

Dev tools

Built-in tooling for inspecting, debugging, and building with AI.

AI-ready documentation

A static context file with the full documentation and schemas, built for LLM coding assistants.

48k tokens of structured context

Blockstudio ships a pre-built blockstudio-llm.txt containing the complete documentation and JSON schemas, with repeated definitions deduplicated.

Enable the setting, point your AI tool at the URL, and it gets full context about every field type, template pattern, and configuration option.

blockstudio-llm.txt
# Blockstudio
Context about the Blockstudio WordPress block framework
for LLM coding assistants.

## Documentation

### Getting Started
Create a folder with a block.json and a template file...

## Schemas

### Block Schema
```json
{"definitions":{"Attribute":{"anyOf":[...]}},...}
```

Full documentation

All documentation in one context file with code examples preserved.

JSON schemas

Block, settings, page, and extension schemas with shared definitions deduplicated.

Optimized for tokens

About 48k tokens, leaving room for your own code in modern context windows.

Works everywhere

Claude Code, Codex, Cursor, Copilot, or any tool accepting a URL or file.

Full-stack blocks

Build complete applications inside a block folder. Database, server logic, scheduled tasks, and CLI, all from files.

Drop a file, get an API

Add db.php to define a data model. Blockstudio creates REST endpoints, validates input, manages storage, and provides JavaScript and PHP APIs.

Add rpc.php for server functions and cron.php for scheduled tasks. Each file does one thing, without controllers or build tooling.

db.php
return [
  'storage'    => 'sqlite',
  'userScoped' => true,
  'capability' => [
    'create' => true,
    'read'   => true,
    'update' => true,
    'delete' => true,
  ],
  'fields' => [
    'text' => ['type' => 'string', 'required' => true],
    'done' => ['type' => 'boolean', 'default' => false],
  ],
];

Server functions in one line

Define PHP functions in rpc.php and call them with bs.fn(). Blockstudio handles routing, authentication, CSRF protection, and JSON serialization.

rpc.php
return [
  'toggle' => function (array $params): array {
    $db = Db::get('my-theme/todo');
    $todo = $db->get_record((int) $params['id']);
    $db->update((int) $params['id'], [
      'done' => !$todo['done'],
    ]);
    return ['success' => true];
  },
];

Questions & Answers

Everything you need to know about Blockstudio. Can’t find what you’re looking for? Reach out to our support team.

A WordPress plugin that lets you build custom blocks with JSON and a template file. Define fields and write markup without React tooling.

No. If you can write HTML and basic PHP, you can build blocks. Blockstudio handles editor internals.

Yes. Blocks use the native WordPress block API and work with any block-compatible theme.

Everything is file-based, with no admin registration UI or PHP boilerplate, plus SCSS, ES modules, scoped assets, and InnerBlocks.

PHP, Twig through Timber, and Blade through Sage or Acorn. All share the same variables and components.

Yes. Extensions add fields to core, third-party, or custom blocks, including whole namespaces through wildcards.

Use naming conventions such as style.scss, script.js, and editor.css. Blockstudio compiles, scopes, and minifies automatically.

Yes. JSON Schema provides autocomplete, inline documentation, and validation in compatible editors.

WordPress 6.7 or later and PHP 8.2 or later.

Yes. Blockstudio is free and open source, with extensions, all field types, assets, pages, and patterns included.

Plus

The official extension kit

Premium site templates, AI system instructions, and a private Discord community. One-time purchase, lifetime updates.

  • 450+ site templates
  • AI system instructions
  • Lifetime updates
  • Private Discord community