Need Help With Worpdress Parent Child Attribute

enter image description here

Generally parent child relationships are done with the page type. See the right side of the image I attached where is says “Parent”. In a single post type, you could also use parent child categories I would think. Possibly with two post types you could use one taxonomy, also with parent child categories. Not recommended usually. Otherwise I guess you would have to set up a meta field and store the parent ID.

In general there is no performance gain having multiple posts type, they are stored in the same “wp_posts” table. And generally multiple post types are used like silos, independent.

Here is a custom hierarchical post type, it will behave like a page.

add_action( 'init', 'create_chapter_post_type' );

function create_chapter_post_type() {
    register_post_type( 'chapters',
        array(
            'labels' => array(
                'name' => __( 'Chapters' ),
                'singular_name' => __( 'Chapter' ),
                'add_new' => 'Add New Chapter',
                'add_new_item' => 'Add New Chapter'
            ),
            'public' => true,
            'hierarchical' => true,
            'supports' => array('title', 'editor', 'page-attributes', 'custom-fields')
        )
    );
}

Again pages support parent child relationships by default.