Exporting Blocks

Export any block definition — or your entire block library — as a portable JSON file.

UI Export

  1. Navigate to BF Blocks → Export in your WordPress admin.
  2. Select the blocks you want to export (individual or select all).
  3. Click Download JSON. A single JSON file containing all selected block definitions is downloaded.

CLI Export

Use WP-CLI for scripted or automated exports:

# Export a single block by slug
wp bf-blocks export --block=testimonial --output=./blocks/testimonial.json

# Export all blocks to a directory
wp bf-blocks export --all --output=./blocks/

# Export with PHP template overrides included
wp bf-blocks export --block=testimonial --include-templates --output=./

What the JSON Contains

  • All field definitions (type, label, key, settings)
  • Block metadata (name, slug, icon, category, keywords)
  • Supports configuration
  • Optional: PHP template overrides (if --include-templates flag used)

Content is not exported

Page content, post data, and media are never included in an export. Only the block definition (structure and settings) is exported.

Versioning in Git

Export your blocks to a /blocks directory in your theme or project repository. Commit the JSON files to Git. This gives you:

  • A complete history of block definition changes
  • The ability to roll back to a previous block version
  • Code review for block definition changes
  • Automated deployment via CI/CD using the WP-CLI import command