Wicked Block Builder can save blocks to JSON files in your theme making it easy to version control your blocks and easily sync them with other sites. The functionality is very similar to Advanced Custom Fields’ local JSON feature.
To use the JSON sync feature, simply create a folder named wbb-json in your site’s theme and make sure the folder is writable by WordPress. Wicked Block Builder will automatically save your blocks to a JSON file any time the block is updated.
When one or more blocks are saved to JSON, a column labeled “Sync Status” will appear in your blocks list. The status will be one of the following:
- Awaiting save: This indicates that your block has not yet been saved to JSON. To save the block to JSON, simply edit the block and save your changes. If the status remains “Awaiting save” even after making changes to your block, the JSON folder most likely isn’t writable by the server. Check the folder’s permissions to ensure it is writable. If you have debugging turned on, an error will also be written to the WordPress debug log indicating that the block could not be saved to JSON.
- Outdated: This indicates that the timestamp in the block’s JSON file is newer than the last saved timestamp of the block. You can sync the changes from the JSON file by clicking the “Sync” link that appears in the block’s actions when hovering over the block’s title.
- Synced: This indicates that the block’s JSON file is up-to-date with all changes that have been made to the block.
When a JSON block file exists for a block that isn’t present on your site, a “Missing” tab will appear at the top of your blocks list. To import the missing block(s), click the “Missing” link and then click “Import” for the block(s) you want to import.
Changing the Location Where JSON Files Are Saved
Use the filter wbb_save_json_path to change the location where your blocks’ JSON files will be saved. The path should be an absolute path that is writable.