A developer-focused plugin for developing block themes for WordPress. Essential tools for pattern authoring (via the native Site Editor) and template export.
- Native Patterns UI: Create and edit patterns in Appearance → Editor → Patterns (
wp_block) - Pattern Details sidebar: Description, keywords, block/post/template types, viewport, inserter, content-only lock, synced toggle
- Dual Mode Operation:
- File Mode (local/dev): Every published pattern save writes
patterns/{slug}.phpin the active stylesheet theme - API Mode (pattern library): Patterns stay as
wp_blockposts; exposed viabtd/v1for other sites
- File Mode (local/dev): Every published pattern save writes
- Synced patterns (Orbit): With Synced theme pattern on, the file includes
Synced: true, thewp_blockis kept, and Orbit syncs layout updates to every instance - Unsynced theme patterns: Synced off → file written without
Synced(DB pattern is kept while editing so the Site Editor does not break)
- Automatic Template Export in File Mode:
- Exports
wp_templatechanges to/templates/{slug}.html - Exports
wp_template_partchanges to/parts/{slug}.html
- Exports
- Successful exports remove DB overrides so files remain the source of truth
- Clone this repository into your WordPress plugins directory
- Run
npm installto install dependencies - Run
npm run buildto build the JavaScript assets - Activate the plugin in your WordPress admin
Requires: WordPress 7.0+, PHP 8.3+
- file: Export patterns/templates to the active theme (local development)
- api: Serve pattern data from
wp_blockvia REST (pattern library sites)
Option 1: wp-config.php (Recommended)
define( 'BLOCK_THEME_DEVELOPER_MODE', 'file' );Option 2: Automatic Detection If not defined:
filemode fordevelopmentorlocalenvironmentsapimode for all other environments
- Open Appearance → Editor → Patterns
- Create or edit a pattern
- Use Pattern Categories (core) and Pattern Details (BTD) in the sidebar
- Save (after the pattern has real block content — empty “Add pattern” creates are ignored):
- Synced (Add Pattern modal or Pattern Details): writes
patterns/{slug}.phpwithSynced: true, keeps thewp_blockfor Orbit - Unsynced: writes the theme file without
Synced, keeps thewp_blockopen in the editor
- Synced (Add Pattern modal or Pattern Details): writes
BTD is not used on production in file mode. Published pattern saves with content export to the theme.
- Create patterns in the Site Editor (they remain as
wp_blockposts) - Fill Pattern Details meta as needed
- Other sites consume them via the REST API (see below)
No theme files are written in API mode.
In file mode, saving templates from the Site Editor exports to the active stylesheet theme:
- Templates:
/templates/{slug}.html - Template parts:
/parts/{slug}.html
When export succeeds, the plugin removes the database override.
Autosaves, revisions, and draft-like states are skipped. Export requires edit_theme_options.
- Install BTD as a local/dev dependency (
filemode) - Author patterns and templates in the Site Editor
- Theme PHP/HTML files update on save — commit them to Git
- Production runs the theme (and Orbit for synced patterns) without BTD
- Run a pattern library site with BTD in
apimode - Author patterns in admin as
wp_blockposts - Client sites pull
GET /wp-json/btd/v1/patternswith Application Passwords
<?php
/**
* Title: My Awesome Pattern
* Slug: my-theme/my-awesome-pattern
* Description: A simple paragraph pattern for greetings
* Categories: hero, text
* Keywords: greeting, hello
* Viewport Width: 1200
* Block Types: core/paragraph
* Post Types: post, page
* Template Types: author, 404
* Inserter: true
* Synced: true
*
* @package MyTheme
*/
?>
<p>Hello world.</p>Get all patterns:
GET /wp-json/btd/v1/patterns
Get authentication information:
GET /wp-json/btd/v1/auth-info
Patterns are loaded from published wp_block posts (not a custom post type). Categories prefer the wp_pattern_category taxonomy, with _btd_categories as fallback.
- Go to Users > Profile
- Scroll to Application Passwords
- Create a password for your client application
- Use HTTP Basic Auth; the user needs the
btd_api_accesscapability
In API mode the plugin creates the btd_api_access capability, an API User role, and grants the capability to administrators.
cURL:
curl -u "username:password" \
https://yoursite.com/wp-json/btd/v1/patternsResponse format:
{
"id": 123,
"name": "my-awesome-pattern",
"title": "My Awesome Pattern",
"content": "<!-- wp:paragraph --><p>Hello world.</p><!-- /wp:paragraph -->",
"description": "A simple paragraph pattern for greetings",
"categories": ["hero", "text"],
"keywords": ["greeting", "hello"],
"viewportWidth": 1200,
"blockTypes": ["core/paragraph"],
"postTypes": ["post", "page"],
"templateTypes": ["author", "404"],
"inserter": true,
"lastUpdated": "2026-07-16 12:00:00",
"created": "2026-07-16 10:00:00"
}npm run start- Start development build with file watchingnpm run build- Build production assetsnpm run lint:js- Lint JavaScript filesnpm run lint:css- Lint CSS filesnpm run format- Format code with Prettier
This plugin follows the eighteen73 WordPress Coding Standards.