Quite stuck on this one. I have a CPT set up and it’s working just fine, except for one small issue. The ‘Parent’ select box does not show up under the ‘Page Attributes’ meta box. I’ve checked and rechecks, so I unless I am missing something really obvious, I am at a loss as to why this is happening. Here’s the code:
function create_posttype_4() {
register_post_type( '1:White',
array(
'menu_icon' => 'dashicons-book-alt',
'labels' => array(
'name' => __( '1:White' ),
'singular_name' => __( '1:White' )
),
'public' => true,
'rewrite' => array(
'slug' => 'white',
'with_front' => true
),
)
);
}
add_action( 'init', 'create_posttype_4' );
function custom_post_type_4() {
$labels = array(
'name' => _x( '1:White', 'Post Type General Name', 'thesilent_2024r0' ),
'singular_name' => _x( '1:White', 'Post Type Singular Name', 'thesilent_2024r0' ),
'attributes' => _x( '1:White', 'Page Attributes', 'thesilent_2024r0' ),
'menu_name' => __( '1:White', 'thesilent_2024r0' ),
'all_items' => __( 'All 1:White', 'thesilent_2024r0' ),
'view_item' => __( 'View 1:White', 'thesilent_2024r0' ),
'add_new_item' => __( 'Add New 1:White', 'thesilent_2024r0' ),
'add_new' => __( 'Add New 1:White', 'thesilent_2024r0' ),
'edit_item' => __( 'Edit 1:White', 'thesilent_2024r0' ),
'update_item' => __( 'Update 1:White', 'thesilent_2024r0' ),
'search_items' => __( 'Search 1:White', 'thesilent_2024r0' ),
'not_found' => __( 'Not Found', 'thesilent_2024r0' ),
'not_found_in_trash' => __( 'Not found in Trash', 'thesilent_2024r0' ),
'parent' => __( '1:White', 'Parent', 'thesilent_2024r0' ),
'labels' => $labels,
);
$args = array(
'hierarchical' => true,
'capability_type' => 'page',
'supports' => array(
'title',
'thumbnail',
'editor',
'excerpt',
'author',
'comments',
'post-formats',
'parent',
'page-attributes'
),
'has_archive' => true,
'taxonomies' => true,
'query_var' => true,
'label' => __( '1:White', 'thesilent_2024r0' ),
'description' => __( '1:White', 'thesilent_2024r0' ),
'show_ui' => true,
'show_in_menu' => true,
'show_in_nav_menus' => true,
'show_in_admin_bar' => true,
'menu_position' => 1,
'can_export' => true,
'exclude_from_search' => false,
'publicly_queryable' => true,
'show_in_rest' => true,
);
register_post_type( '1:White', $args );
}
add_action( 'init', 'custom_post_type_4', 0 );