The plugin scaffold has been updated to leverage Secure Custom Fields (SCF) Local JSON for registering post types and taxonomies, instead of manual PHP registration. This provides version control, automatic synchronization, and better maintainability.
- Old Format:
posttype_{slug}.jsonwith custom schema - New Format:
post-type-{slug}.jsonwith SCF schema
Example Structure:
{
"key": "post_type_webinar",
"title": "Webinar/Event",
"post_type": "webinar",
"menu_order": 0,
"active": true,
"public": true,
"hierarchical": false,
"supports": ["title", "editor", "thumbnail"],
"taxonomies": ["brand", "speciality"],
"has_archive": true,
"rewrite": {
"slug": "webinar",
"with_front": true
},
"labels": {
"name": "Webinars & Events",
"singular_name": "Webinar/Event",
// ... 15+ label properties
}
}- Old Format:
taxonomy_{slug}.jsonwith minimal properties - New Format:
taxonomy-{slug}.jsonwith SCF schema
Example Structure:
{
"key": "taxonomy_brand",
"title": "Brand",
"taxonomy": "brand",
"menu_order": 0,
"active": true,
"object_type": ["webinar", "sfwd_course"],
"public": true,
"hierarchical": false,
"show_ui": true,
"show_in_rest": true,
"labels": {
"name": "Brands",
"singular_name": "Brand",
// ... 10+ label properties
},
"rewrite": {
"slug": "brand",
"with_front": true,
"hierarchical": false
}
}File: inc/class-scf-json.php
Added filters for post type and taxonomy registration:
public function __construct() {
$this->json_path = PLUGIN_DIR . 'scf-json';
// Field groups (original).
add_filter( 'acf/settings/save_json', array( $this, 'set_save_path' ) );
add_filter( 'acf/settings/load_json', array( $this, 'add_load_path' ) );
// Post types (new).
add_filter( 'acf/settings/save_json/type=acf-post-type', array( $this, 'set_save_path' ) );
add_filter( 'acf/json/load_paths', array( $this, 'add_post_type_load_paths' ) );
// Taxonomies (new).
add_filter( 'acf/settings/save_json/type=acf-taxonomy', array( $this, 'set_save_path' ) );
add_filter( 'acf/json/load_paths', array( $this, 'add_taxonomy_load_paths' ) );
$this->maybe_create_directory();
}
public function add_post_type_load_paths( $paths ) {
$paths[] = $this->json_path;
return $paths;
}
public function add_taxonomy_load_paths( $paths ) {
$paths[] = $this->json_path;
return $paths;
}File: inc/class-content-model-manager.php
Removed manual registration:
/**
* Initialize content model manager.
*
* Post types and taxonomies are now registered via Secure Custom Fields (SCF)
* Local JSON. See scf-json/ directory for post-type-*.json and taxonomy-*.json files.
*
* @since 1.0.0
*/
public static function init() {
// Load JSON configurations for internal reference only.
// SCF handles actual registration of post types and taxonomies.
self::load_configurations();
self::build_taxonomy_map();
}File: scripts/generate-plugin.js
- Changed file naming:
posttype_→post-type- - Complete rewrite to output SCF schema format
- Includes all required SCF properties
- Generates complete labels object (15+ properties)
- Uses tab indentation to match SCF exports
- Changed file naming:
taxonomy_→taxonomy- - Complete rewrite to output SCF schema format
- Includes all required SCF properties
- Generates complete labels object (10+ properties)
- Handles hierarchical vs non-hierarchical labels
- Uses tab indentation to match SCF exports
- Plugin activation → SCF reads JSON files from
scf-json/directory - SCF loads:
post-type-*.json→ Registers custom post typestaxonomy-*.json→ Registers taxonomiesgroup_*.json→ Loads field groups
- WordPress registers the post types/taxonomies automatically
- Flush permalinks to update rewrite rules
plugin-name/
├── scf-json/
│ ├── post-type-webinar.json # Post type registration
│ ├── post-type-digital_magazine.json # Post type registration
│ ├── taxonomy-brand.json # Taxonomy registration
│ ├── taxonomy-speciality.json # Taxonomy registration
│ ├── group_webinar_fields.json # Field group
│ └── group_digital_magazine_fields.json # Field group
└── inc/
├── class-scf-json.php # Configures SCF JSON paths
└── class-content-model-manager.php # Loads configs (reference only)
- JSON files tracked in Git
- Changes visible in diffs
- Easy rollback of schema changes
- SCF automatically syncs JSON ↔ WordPress
- Changes made in admin saved to JSON
- JSON changes loaded on next page load
- No PHP
register_post_type()calls - No PHP
register_taxonomy()calls - Cleaner codebase
- Same schema across dev/staging/production
- No database dependencies for schema
- Easier deployment
- Declarative schema definition
- Standard SCF format
- Easier to understand and modify
- Backup current post type/taxonomy registration code
- Generate SCF JSON files using the scaffold
- Update
inc/class-scf-json.phpwith new filters - Update
inc/class-content-model-manager.phpto remove registration - Test in development environment
- Deploy to production
- Flush permalinks in WordPress admin
Just run the generator with your config - everything is automatic!
node scripts/generate-plugin.js \
--config your-plugin-config.json \
--output ../your-plugin \
--forceAfter generation:
- Post types appear in WordPress admin menu
- Post types have correct icons
- Taxonomies appear in admin
- Taxonomies attached to correct post types
- Field groups load correctly
- Block bindings work with SCF fields
- Field picker dropdown shows fields
- Archive pages work
- Single post templates work
- Rewrite rules functional (flush permalinks)
- Check
scf-json/post-type-*.jsonfiles exist - Verify file naming:
post-type-{slug}.json(hyphenated) - Verify
keyproperty:post_type_{slug}(underscored) - Check SCF_JSON class filters are registered
- Flush permalinks: Settings → Permalinks → Save
- Check
scf-json/taxonomy-*.jsonfiles exist - Verify file naming:
taxonomy-{slug}.json(hyphenated) - Verify
keyproperty:taxonomy_{slug}(underscored) - Check
object_typearray includes correct post types - Flush permalinks
- Check
scf-json/group_*.jsonfiles exist - Verify location rules include correct post types
- Check SCF_JSON class
add_load_path()method - Verify
acf/settings/load_jsonfilter is registered
- SCF Local JSON Documentation
- SCF Post Type Registration
- SCF Taxonomy Registration
- WordPress register_post_type()
- WordPress register_taxonomy()
{
"key": "post_type_{slug}", // REQUIRED: "post_type_" prefix
"title": "Display Name", // REQUIRED: Admin display
"post_type": "{slug}", // REQUIRED: 20 chars max, lowercase
"menu_order": 0, // Menu position
"active": true, // Enable/disable
"public": true, // Public visibility
"hierarchical": false, // Pages vs Posts style
"supports": [], // Feature support
"taxonomies": [], // Attached taxonomies (slugs only)
"has_archive": true, // Archive page
"rewrite": {}, // URL rewrite rules
"labels": {} // All admin labels
}{
"key": "taxonomy_{slug}", // REQUIRED: "taxonomy_" prefix
"title": "Display Name", // REQUIRED: Admin display
"taxonomy": "{slug}", // REQUIRED: 32 chars max, lowercase
"menu_order": 0, // Menu position
"active": true, // Enable/disable
"object_type": [], // REQUIRED: Post types (slugs)
"public": true, // Public visibility
"hierarchical": false, // Categories vs Tags style
"show_ui": true, // Show in admin
"show_in_rest": true, // REST API support
"rewrite": {}, // URL rewrite rules
"labels": {} // All admin labels
}- File naming uses hyphens:
post-type-,taxonomy- - Key property uses underscores:
post_type_,taxonomy_ - Tab indentation matches SCF export format
- Complete labels improve admin UX
- SCF validates JSON on load (check logs for errors)
- Flush permalinks after any post type/taxonomy changes
Last Updated: 2026-02-02
Version: 2.0.0
Scaffold: block-plugin-scaffold