Gutenberg Blocks Presets
A powerful plugin for creating and managing reusable Gutenberg block presets. Allows you to create custom block templates and ACF blocks that can be reused across your website.
by davet86 · github.com/neodavet/gutenberg-blocks-presets · website
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/neodavet/gutenberg-blocks-presets/archive/refs/heads/main.zipA free, open-source WordPress plugin to create and manage reusable Gutenberg block presets. Build content once and reuse it anywhere via a native block, PHP helpers, shortcodes, or REST API.
- Author: davet86
- Plugin URI: https://neodavet.github.io/davetportfolio/
- License: GPL v2 or later
- Requires: WordPress 5.9+, PHP 7.4+
- Tested up to: WordPress 6.6
Key Features
- Native custom post type for presets:
gbp_block_preset - Gutenberg block to insert presets (
gbp/block-preset) - Shortcodes:
[gbp_block id="123"]and legacy[block_preset id="123"] - PHP helpers:
gbp_render_block_preset()and legacydo_cpt_block() - Taxonomies: categories (
gbp_block_category) and tags (gbp_block_tag) - Usage tracking: local table logs where presets are used
- REST API: list, fetch, and render presets
- Admin UI: Settings, Tools, and Statistics
- Migration tools: from legacy post type
block - Optional ACF integration: auto-register ACF blocks from theme folders (only when enabled and ACF Pro is installed)
- Translation-ready and full uninstall cleanup
Installation
- Upload
gutenberg-blocks-presets/towp-content/plugins/. - Activate “Gutenberg Blocks Presets” in Plugins.
- Go to Settings → Blocks Presets to configure.
- Create presets under the “Block Presets” menu and use the block or shortcodes in your content.
Usage
Gutenberg Block
- Insert “Block Preset” in the editor
- Use the sidebar to search/filter and select a preset
- Options: show title, custom CSS class, alignment
PHP
// Recommended
gbp_render_block_preset(123);
// Legacy (still supported)
do_cpt_block(123);
Shortcodes
[gbp_block id="123"](recommended)[block_preset id="123"](legacy)
REST API
GET /wp-json/gbp/v1/block-presetsGET /wp-json/gbp/v1/block-presets/{id}GET /wp-json/gbp/v1/block-presets/{id}/render
Settings Overview
Find these under Settings → Blocks Presets.
- Enable Block Presets: core
gbp_block_presetfunctionality - Enable ACF Blocks (Optional): auto-register ACF blocks from theme folders when ACF Pro is active
- Enable Legacy Post Type: keep legacy
blockpost type for backward compatibility during migration - ACF Block Folders (one per line):
general/acf-blockspublic/acf-blockslogin-register/acf-blocksmembers/acf-blocks
ACF Integration (Optional)
When enabled and ACF Pro is installed, the plugin can:
- Register ACF blocks from configured theme folders
- Provide a “Custom ACF Blocks” category in the editor
- Load per-block CSS/JS assets if present
If ACF is not installed or ACF features are disabled, the plugin works fully with native WordPress features.
Migration Guide (from legacy systems)
- Activate the plugin.
- Visit Settings → Blocks Presets and verify:
- Enable Block Presets: ON
- Enable Legacy Post Type: ON (during migration)
- Enable ACF Blocks: optional (only if you use ACF Pro)
- Use Block Presets → Tools to migrate old content if needed.
- Test:
- Legacy
do_cpt_block()calls still work - New
gbp_render_block_preset()and the Gutenberg block
- Legacy
- After confirming everything works, disable “Enable Legacy Post Type”.
Troubleshooting
- ACF blocks not appearing:
- Ensure ACF Pro is active and “Enable ACF Blocks” is ON
- Verify folders exist and are configured in Settings
- Old blocks not working:
- Keep “Enable Legacy Post Type” ON during migration
- Run migration tools in Block Presets → Tools
- Duplicate menus or conflicts:
- Ensure no theme or other plugin registers the same post types
Privacy
- The plugin creates a local table tracking preset usage (block ID, post ID, usage count, last used date)
- No personal data is collected by this feature and no data is sent to third parties
- Uninstalling from the Plugins screen removes plugin data (posts, options, tables)
Contributing
Contributions are welcome! Open an issue or submit a pull request.
- Follow WordPress coding standards
- Keep user-facing strings translatable (
__(),_x()) with text domaingutenberg-blocks-presets - Add sanitization/escaping and capability checks where appropriate
- Include unminified sources for any bundled/minified assets
License
GPL v2.0 or later. See license.txt or:
https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
Credits
Created and maintained by davet86. Learn more: https://neodavet.github.io/davetportfolio/