Guide for creating WordPress Playground Blueprint JSON files and executing WP-CLI commands...
Blueprints are JSON configuration files that set up WordPress Playground instances with specific versions, plugins, themes, content, and settings.
Blueprints are JSON configuration files that:
Always include the schema reference as the first property:
{
"$schema": "https://playground.wordpress.net/blueprint-schema.json"
}
landingPage (string)The URL to navigate to after blueprint execution. Use relative paths.
{
"landingPage": "/wp-admin/site-editor.php"
}
Common landing pages:
/ - Homepage/wp-admin/ - Admin dashboard/wp-admin/post.php?post=4&action=edit - Edit specific post/wp-admin/site-editor.php - Site editor/wp-admin/plugin-install.php - Plugin installerpreferredVersions (object)Specify PHP and WordPress versions.
{
"preferredVersions": {
"php": "8.3",
"wp": "latest"
}
}
Supported PHP versions: "8.4", "8.3", "8.2", "8.1", "8.0", "7.4", "7.3", "7.2", or "latest"
Supported WordPress versions: "latest", "nightly", "beta", or specific versions like "6.5", "6.6", "6.7", "6.8"
For older WordPress versions (6.2.1+):
{
"preferredVersions": {
"wp": "https://playground.wordpress.net/plugin-proxy.php?url=https://wordpress.org/wordpress-6.2.1.zip",
"php": "8.3"
}
}
For WordPress trunk or specific commits:
{
"preferredVersions": {
"wp": "https://playground.wordpress.net/plugin-proxy.php?build-ref=trunk",
"php": "8.3"
}
}
features (object)Enable/disable Playground features.
{
"features": {
"networking": true
}
}
networking (boolean): Enable HTTP requests (required for plugin/theme installation from WordPress.org)extraLibraries (array)Preload additional libraries.
{
"extraLibraries": ["wp-cli"]
}
Currently supported: "wp-cli"
meta (object)Metadata for blueprint gallery (optional but recommended).
{
"meta": {
"title": "My Blueprint",
"description": "A brief explanation of what this blueprint does",
"author": "github-username",
"categories": ["development", "ecommerce"]
}
}
These provide concise alternatives to step definitions:
login (boolean or object){
"login": true
}
Equivalent to:
{
"steps": [
{
"step": "login",
"username": "admin",
"password": "password"
}
]
}
plugins (array){
"plugins": [
"hello-dolly",
"https://example.com/plugin.zip"
]
}
Equivalent to multiple installPlugin steps.
siteOptions (object){
"siteOptions": {
"blogname": "My Site",
"blogdescription": "Just another WordPress site"
}
}
Equivalent to setSiteOptions step.
constants (object){
"constants": {
"WP_DEBUG": true,
"WP_DEBUG_DISPLAY": true
}
}
Equivalent to defineWpConfigConsts step.
The steps array defines actions to execute sequentially. Each step is an object with a step property identifying its type.
All steps support optional progress configuration:
{
"step": "installPlugin",
"progress": {
"weight": 2,
"caption": "Installing my plugin..."
}
}
Many steps accept file/directory references. All resource types:
{
"resource": "url",
"url": "https://example.com/file.zip",
"caption": "Downloading plugin..."
}
{
"resource": "wordpress.org/plugins",
"slug": "akismet",
"version": "5.0"
}
{
"resource": "wordpress.org/themes",
"slug": "twentytwentyfour",
"version": "1.0"
}
{
"resource": "git:directory",
"url": "https://github.com/WordPress/block-development-examples",
"ref": "HEAD",
"path": "plugins/data-basics-59c8f8"
}
{
"resource": "bundled",
"path": "/my-plugin.zip"
}
{
"resource": "vfs",
"path": "/wordpress/wp-content/my-file.php"
}
{
"resource": "literal",
"name": "my-file.txt",
"contents": "Hello World!"
}
Installs a WordPress plugin.
{
"step": "installPlugin",
"pluginData": {
"resource": "wordpress.org/plugins",
"slug": "gutenberg"
},
"options": {
"activate": true
}
}
Properties:
pluginData: FileReference or DirectoryReference (required)options.activate: Boolean to activate after installoptions.targetFolderName: Custom folder nameifAlreadyInstalled: "overwrite", "skip", or "error"Installs a WordPress theme.
{
"step": "installTheme",
"themeData": {
"resource": "wordpress.org/themes",
"slug": "twentytwentyfour"
},
"options": {
"activate": true,
"importStarterContent": false
}
}
Properties:
themeData: FileReference or DirectoryReference (required)options.activate: Boolean to activate after installoptions.importStarterContent: Boolean to import starter contentoptions.targetFolderName: Custom folder nameifAlreadyInstalled: "overwrite", "skip", or "error"Activates an installed plugin.
{
"step": "activatePlugin",
"pluginPath": "plugin-folder/plugin-file.php",
"pluginName": "My Plugin"
}
Properties:
pluginPath: Absolute path or relative to plugins directory (required)pluginName: Display name for progress (optional)Activates an installed theme.
{
"step": "activateTheme",
"themeFolderName": "twentytwentyfour"
}
Logs in as a WordPress user.
{
"step": "login",
"username": "admin"
}
Note: password parameter is deprecated and no longer required.
Executes PHP code.
{
"step": "runPHP",
"code": "<?php require_once '/wordpress/wp-load.php'; wp_insert_post(['post_title' => 'Hello', 'post_status' => 'publish', 'post_author' => 1]);"
}
CRITICAL: Always require /wordpress/wp-load.php when using WordPress functions.
Alternative format:
{
"step": "runPHP",
"code": {
"filename": "my-script.php",
"content": "<?php require_once '/wordpress/wp-load.php'; // your code"
}
}
Executes SQL queries.
{
"step": "runSql",
"sql": {
"resource": "literal",
"name": "queries.sql",
"contents": "UPDATE wp_posts SET post_status='publish' WHERE post_status='draft';"
}
}
Sets WordPress site options.
{
"step": "setSiteOptions",
"options": {
"blogname": "My Awesome Site",
"blogdescription": "A demo site",
"permalink_structure": "/%postname%/"
}
}
Defines WordPress constants in wp-config.php.
{
"step": "defineWpConfigConsts",
"consts": {
"WP_DEBUG": true,
"WP_DEBUG_LOG": true,
"WP_DEBUG_DISPLAY": false,
"WP_DISABLE_FATAL_ERROR_HANDLER": true
},
"method": "rewrite-wp-config"
}
Methods:
"rewrite-wp-config": Modifies wp-config.php file (default)"define-before-run": Defines before script execution (no file modification)Sets the WordPress site URL.
{
"step": "defineSiteUrl",
"siteUrl": "https://example.com"
}
Imports WordPress content from WXR file.
{
"step": "importWxr",
"file": {
"resource": "url",
"url": "https://example.com/content.wxr"
}
}
Imports a theme's starter content.
{
"step": "importThemeStarterContent",
"themeSlug": "twentytwentyfour"
}
Writes content to a file.
{
"step": "writeFile",
"path": "/wordpress/wp-content/mu-plugins/custom.php",
"data": "<?php // Custom code"
}
Data can be:
Writes multiple files from a directory structure.
{
"step": "writeFiles",
"writeToPath": "/wordpress/wp-content/themes/my-theme",
"filesTree": {
"resource": "literal:directory",
"name": "my-theme",
"files": {
"style.css": "/* Theme styles */",
"functions.php": "<?php // Theme functions",
"templates/index.html": "<!-- Template -->"
}
}
}
Creates a directory.
{
"step": "mkdir",
"path": "/wordpress/wp-content/uploads/custom"
}
Copies a file or directory.
{
"step": "cp",
"fromPath": "/wordpress/wp-content/plugins/source",
"toPath": "/wordpress/wp-content/plugins/destination"
}
Moves/renames a file or directory.
{
"step": "mv",
"fromPath": "/wordpress/wp-content/themes/old-name",
"toPath": "/wordpress/wp-content/themes/new-name"
}
Removes a file.
{
"step": "rm",
"path": "/wordpress/wp-content/plugins/unwanted.php"
}
Removes a directory.
{
"step": "rmdir",
"path": "/wordpress/wp-content/themes/old-theme"
}
Extracts a zip file.
{
"step": "unzip",
"zipFile": {
"resource": "url",
"url": "https://example.com/files.zip"
},
"extractToPath": "/wordpress/wp-content/uploads"
}
Makes an HTTP request to WordPress.
{
"step": "request",
"request": {
"url": "/wp-admin/admin-ajax.php",
"method": "POST",
"headers": {
"Content-Type": "application/x-www-form-urlencoded"
},
"body": "action=my_action&data=value"
}
}
Executes WP-CLI commands.
{
"step": "wp-cli",
"command": "post list --format=json"
}
Or with array format:
{
"step": "wp-cli",
"command": ["post", "create", "--post_title=Hello", "--post_status=publish"]
}
Note: Requires "extraLibraries": ["wp-cli"] or will be auto-included if using wp-cli steps.
Enables WordPress multisite.
{
"step": "enableMultisite"
}
Resets WordPress database to initial state.
{
"step": "resetData"
}
Updates user metadata.
{
"step": "updateUserMeta",
"userId": 1,
"meta": {
"first_name": "John",
"last_name": "Doe",
"description": "WordPress developer"
}
}
Sets the site language.
{
"step": "setSiteLanguage",
"language": "es_ES"
}
Runs the WordPress installation wizard.
{
"step": "runWpInstallationWizard",
"options": {
"adminUsername": "admin",
"adminPassword": "password"
}
}
Runs PHP with detailed options.
{
"step": "runPHPWithOptions",
"options": {
"code": "<?php echo 'Hello';",
"env": {
"MY_VAR": "value"
},
"$_SERVER": {
"REQUEST_METHOD": "POST"
}
}
}
{
"$schema": "https://playground.wordpress.net/blueprint-schema.json",
"landingPage": "/wp-admin/plugins.php",
"preferredVersions": {
"php": "8.3",
"wp": "latest"
},
"features": {
"networking": true
},
"steps": [
{
"step": "login"
},
{
"step": "installPlugin",
"pluginData": {
"resource": "url",
"url": "https://example.com/my-plugin.zip"
},
"options": {
"activate": true
}
}
]
}
{
"$schema": "https://playground.wordpress.net/blueprint-schema.json",
"landingPage": "/",
"preferredVersions": {
"php": "8.3",
"wp": "latest"
},
"features": {
"networking": true
},
"siteOptions": {
"blogname": "Demo Site"
},
"steps": [
{
"step": "installTheme",
"themeData": {
"resource": "wordpress.org/themes",
"slug": "twentytwentyfour"
},
"options": {
"activate": true,
"importStarterContent": true
}
},
{
"step": "importWxr",
"file": {
"resource": "url",
"url": "https://example.com/sample-content.xml"
}
}
]
}
{
"$schema": "https://playground.wordpress.net/blueprint-schema.json",
"landingPage": "/wp-admin/",
"preferredVersions": {
"php": "8.3",
"wp": "latest"
},
"features": {
"networking": true
},
"constants": {
"WP_DEBUG": true,
"WP_DEBUG_LOG": true,
"WP_DEBUG_DISPLAY": true,
"SCRIPT_DEBUG": true
},
"login": true,
"plugins": ["query-monitor", "debug-bar"],
"steps": [
{
"step": "setSiteOptions",
"options": {
"permalink_structure": "/%postname%/"
}
}
]
}
{
"$schema": "https://playground.wordpress.net/blueprint-schema.json",
"landingPage": "/",
"steps": [
{
"step": "writeFile",
"path": "/wordpress/wp-content/mu-plugins/custom-functions.php",
"data": "<?php\nadd_action('after_setup_theme', function() {\n global $wp_rewrite;\n $wp_rewrite->set_permalink_structure('/%postname%/');\n $wp_rewrite->flush_rules();\n});"
}
]
}
{
"$schema": "https://playground.wordpress.net/blueprint-schema.json",
"landingPage": "/wp-admin/",
"extraLibraries": ["wp-cli"],
"features": {
"networking": true
},
"steps": [
{
"step": "login"
},
{
"step": "wp-cli",
"command": "plugin install gutenberg --activate"
},
{
"step": "wp-cli",
"command": ["post", "create", "--post_title=Hello World", "--post_status=publish"]
}
]
}
For a bundle named my-bundle.zip containing:
/blueprint.json/my-plugin.zip/assets/custom.css{
"$schema": "https://playground.wordpress.net/blueprint-schema.json",
"landingPage": "/",
"steps": [
{
"step": "installPlugin",
"pluginData": {
"resource": "bundled",
"path": "/my-plugin.zip"
},
"options": {
"activate": true
}
},
{
"step": "writeFile",
"path": "/wordpress/wp-content/themes/twentytwentyfour/custom.css",
"data": {
"resource": "bundled",
"path": "/assets/custom.css"
}
}
]
}
{
"$schema": "https://playground.wordpress.net/blueprint-schema.json"
}
"latest" for most casesIf installing from wordpress.org or making HTTP requests:
{
"features": {
"networking": true
}
}
Instead of:
{
"steps": [
{
"step": "login",
"username": "admin"
}
]
}
Use:
{
"login": true
}
{
"step": "runPHP",
"code": "<?php require_once '/wordpress/wp-load.php'; // Your WordPress code"
}
{
"step": "installPlugin",
"progress": {
"caption": "Installing WooCommerce (this may take a moment)..."
},
"pluginData": {
"resource": "wordpress.org/plugins",
"slug": "woocommerce"
}
}
{
"step": "installPlugin",
"pluginData": { ... },
"ifAlreadyInstalled": "skip"
}
Options: "overwrite", "skip", "error"
/ or relevant page/wp-admin/ or specific admin page{
"meta": {
"title": "WooCommerce Demo",
"description": "A complete WooCommerce store setup",
"author": "your-github-username",
"categories": ["ecommerce", "demo"]
}
}
Group related steps with comments (in your development environment):
{
"steps": [
{
"step": "login"
},
// Install core plugins
{
"step": "installPlugin",
"pluginData": { ... }
},
// Configure site
{
"step": "setSiteOptions",
"options": { ... }
}
]
}
Problem: wp-cli commands fail with database connection error.
Solution: Explicitly install SQLite integration:
{
"plugins": ["sqlite-database-integration"]
}
Problem: Plugin installs but doesn't activate.
Solution: Ensure activate: true in options:
{
"step": "installPlugin",
"pluginData": { ... },
"options": {
"activate": true
}
}
Problem: WordPress functions undefined in PHP code.
Solution: Always require wp-load.php:
{
"step": "runPHP",
"code": "<?php require_once '/wordpress/wp-load.php'; wp_insert_post([...]);"
}
Problem: Can't install plugins from wordpress.org.
Solution: Enable networking:
{
"features": {
"networking": true
}
}
Problem: Files not found or created in wrong location.
Solution: Use absolute paths starting with /wordpress/:
/wordpress/wp-content/plugins//wordpress/wp-content/themes//wordpress/wp-content/uploads//wordpress/wp-content/mu-plugins/{
"step": "runPHP",
"code": "<?php error_log('Debug message: ' . print_r($data, true));"
}
View logs via Playground menu: Options > View Logs
Build blueprints step by step, testing after each addition.
Use the schema for validation:
{
"$schema": "https://playground.wordpress.net/blueprint-schema.json"
}
https://playground.wordpress.net/#{"preferredVersions":{"php":"8.3","wp":"latest"}}
https://playground.wordpress.net/#eyJwcmVmZXJyZWRWZXJzaW9ucyI6eyJwaHAiOiI4LjMiLCJ3cCI6ImxhdGVzdCJ9fQ==
https://playground.wordpress.net/?blueprint-url=https://example.com/blueprint.json
Must serve with CORS header:
Access-Control-Allow-Origin: *
https://playground.wordpress.net/?blueprint-url=https://example.com/my-bundle.zip
{
"steps": [
{
"step": "enableMultisite"
}
]
}
{
"preferredVersions": {
"wp": "https://playground.wordpress.net/plugin-proxy.php?build-ref=trunk",
"php": "8.3"
}
}
{
"step": "installPlugin",
"pluginData": {
"resource": "git:directory",
"url": "https://github.com/WordPress/block-development-examples",
"ref": "HEAD",
"path": "plugins/data-basics-59c8f8"
}
}
WP-CLI is a command-line interface for WordPress that enables powerful automation and management tasks. Use WP-CLI both in blueprints and directly for WordPress/WooCommerce operations.
To use WP-CLI commands in blueprints, load the wp-cli library:
{
"$schema": "https://playground.wordpress.net/blueprint-schema.json",
"extraLibraries": ["wp-cli"],
"steps": [
{
"step": "wp-cli",
"command": "plugin list --status=active"
}
]
}
# Download WordPress
wp core download
# Install WordPress
wp core install --url=example.com --title="Site Title" --admin_user=admin --admin_password=pass --admin_email=admin@example.com
# Update WordPress
wp core update
# List plugins
wp plugin list
wp plugin list --status=active --format=json
# Install and activate
wp plugin install akismet --activate
wp plugin install woocommerce --activate
# Update all plugins
wp plugin update --all
# List themes
wp theme list
# Install and activate
wp theme install twentytwentyfour --activate
# Update themes
wp theme update --all
# Create database
wp db create
# Export database
wp db export backup.sql
# Search and replace
wp search-replace 'http://oldsite.com' 'https://newsite.com'
wp search-replace 'old' 'new' --dry-run
# Create user
wp user create bob bob@example.com --role=author
# List users
wp user list --role=administrator
# Update password
wp user update 1 --user_pass=newpassword
# Get option
wp option get blogname
# Update option
wp option update blogname "My New Site"
All WooCommerce commands require --user=<id> parameter for authentication.
# List products
wp wc product list --user=1
wp wc product list --user=1 --status=publish --format=json
# Create product
wp wc product create --user=1 \
--name="T-Shirt" \
--type=simple \
--regular_price=19.99 \
--sku=TSHIRT001
# Update product
wp wc product update 123 --user=1 --regular_price=24.99
# Delete product
wp wc product delete 123 --user=1 --force
# Create customer
wp wc customer create --user=1 \
--email=customer@example.com \
--first_name=John \
--last_name=Doe \
--username=johndoe \
--password=securepass
# List customers
wp wc customer list --user=1 --format=json
# Update customer
wp wc customer update 17 --user=1 --email=newemail@example.com
# List orders
wp wc shop_order list --user=1
wp wc shop_order list --user=1 --status=processing
# Update order status
wp wc shop_order update 355 --user=1 --status=completed
# Add order note
wp wc order_note create 355 --user=1 \
--note="Package shipped" \
--customer_note=true
# Create coupon
wp wc shop_coupon create --user=1 \
--code=SUMMER20 \
--discount_type=percent \
--amount=20 \
--description="Summer sale"
# Update coupon
wp wc shop_coupon update 45 --user=1 --amount=25
# List coupons
wp wc shop_coupon list --user=1
{
"step": "wp-cli",
"command": "plugin list --status=active"
}
{
"$schema": "https://playground.wordpress.net/blueprint-schema.json",
"extraLibraries": ["wp-cli"],
"features": {
"networking": true
},
"steps": [
{
"step": "installPlugin",
"pluginData": {
"resource": "wordpress.org/plugins",
"slug": "woocommerce"
},
"options": {
"activate": true
}
},
{
"step": "wp-cli",
"command": "wc product create --user=1 --name='Demo Product' --type=simple --regular_price=29.99"
},
{
"step": "wp-cli",
"command": "wc product_cat create --user=1 --name='Electronics'"
},
{
"step": "wp-cli",
"command": "wc shop_coupon create --user=1 --code=WELCOME10 --discount_type=percent --amount=10"
}
]
}
{
"extraLibraries": ["wp-cli"],
"steps": [
{
"step": "wp-cli",
"command": "option update blogname 'My Awesome Store'"
},
{
"step": "wp-cli",
"command": "option update blogdescription 'Best products online'"
},
{
"step": "wp-cli",
"command": "plugin install woocommerce --activate"
},
{
"step": "wp-cli",
"command": "theme install storefront --activate"
}
]
}
All WP-CLI commands support multiple output formats:
--format=table # Default table view
--format=json # JSON output
--format=csv # CSV output
--format=yaml # YAML output
--format=ids # Space-separated IDs
--format=count # Count only
wp core download
wp config create --dbname=wpdb --dbuser=root --dbpass=password
wp db create
wp core install --url=localhost --title="My Site" --admin_user=admin --admin_email=admin@example.com
wp db export backup.sql
wp search-replace 'http://oldsite.com' 'https://newsite.com' --dry-run
wp search-replace 'http://oldsite.com' 'https://newsite.com'
wp cache flush
wp plugin update --all
wp theme update --all
wp media regenerate --yes
"plugins": ["sqlite-database-integration"]--user=<id> for WooCommerce commands--path to specify WordPress directory/wordpress/For comprehensive command references, see:
Read these references when you need:
These work with all commands:
--path=<path> - Path to WordPress installation--url=<url> - URL for multisite subsites--user=<id> - Run as specific user (required for WooCommerce)--skip-plugins - Skip loading plugins--skip-themes - Skip loading themes--quiet - Suppress output--debug - Show debugging outputwp db export)wp help <command>)wp --debug <command>)--user=1 for WooCommerce)wp --info)When building blueprints:
resource property valuesBefore finalizing a blueprint:
$schema reference/wordpress/runPHP steps include require_once '/wordpress/wp-load.php'networking enabled if neededCommon blueprint types:
| Step | Purpose |
|---|---|
activatePlugin |
Activate an installed plugin |
activateTheme |
Activate an installed theme |
cp |
Copy file/directory |
defineWpConfigConsts |
Define WordPress constants |
defineSiteUrl |
Set site URL |
enableMultisite |
Enable multisite |
importWxr |
Import WXR content |
importThemeStarterContent |
Import theme starter content |
importWordPressFiles |
Import WordPress files from zip |
installPlugin |
Install a plugin |
installTheme |
Install a theme |
login |
Log in as user |
mkdir |
Create directory |
mv |
Move/rename file/directory |
request |
Make HTTP request |
resetData |
Reset database |
rm |
Remove file |
rmdir |
Remove directory |
runPHP |
Execute PHP code |
runPHPWithOptions |
Execute PHP with options |
runSql |
Execute SQL queries |
runWpInstallationWizard |
Run WP installer |
setSiteOptions |
Set site options |
setSiteLanguage |
Set site language |
unzip |
Extract zip file |
updateUserMeta |
Update user metadata |
wp-cli |
Execute WP-CLI command |
writeFile |
Write single file |
writeFiles |
Write multiple files |
"wordpress.org/plugins" - Official WordPress.org plugins"wordpress.org/themes" - Official WordPress.org themes "url" - Remote files via HTTPS"git:directory" - Git repositories or subdirectories"bundled" - Files included in blueprint bundle"vfs" - Files in virtual filesystem"literal" - Inline contentThis skill provides comprehensive guidance for building WordPress Playground Blueprints that strictly conform to the official schema. Always validate against the schema and test blueprints incrementally.