This repository was archived by the owner on May 30, 2025. It is now read-only.
This repository was archived by the owner on May 30, 2025. It is now read-only.
[Blueprints v2] Create custom post types using SCF #21
Open
Description
This code could replace adding a custom mu-plugin when handling postTypes
:
$instance = acf_get_internal_post_type_instance( 'acf-post-type' );
if ( ! $instance ) {
return;
}
// Define our post type configuration (similar to what you'd fill in the UI)
// This structure mirrors what SCF creates when you use the UI to create a post type
$post_type_config = array(
'key' => 'scf_test_post_type',
'title' => 'SCF Test Type',
'post_type' => 'scf-test-type',
'description' => 'Test post type for testing',
'active' => 1,
'public' => 1,
'show_in_rest' => 1,
'publicly_queryable' => 1,
'show_ui' => 1,
'show_in_menu' => 1,
'has_archive' => 1,
'supports' => array( 'title', 'editor' ),
'labels' => array(
'name' => 'SCF Test Type',
'singular_name' => 'SCF Test Item',
),
);
// Create the post type entry in the database using SCF's internal API
$result = $instance->update_post( $post_type_config );
Activity