I have custom post type -- Team how to create custom table for this post type help me I have created Custom post type but it does not insert any wordpress table. I want to create custom table in phpmyadmin and insert the post data like Id, date, post name etc in custom table. How can i do this please help me.
function team_post_init() {
$labels = array(
'name' => ' All Teams',
'singular_name' => 'Product',
'add_new' => 'Add New Team',
'add_new_item' => 'Add New Team',
'edit_item' => 'Edit Team',
'new_item' => 'New Team',
'all_items' => 'All Teams',
'view_item' => 'View Team',
'search_items' => 'Search Teams',
'not_found' => 'No Teams Found',
'not_found_in_trash' => 'No Teams found in Trash',
'parent_item_colon' => '',
'menu_name' => 'Teams',
);
$args = array(
'labels' => $labels,
'public' => true,
'has_archive' => true,
'show_ui' => true,
'show_admin_column' => true,
'capability_type' => 'post',
'hierarchical' => false,
'rewrite' => array('slug' => 'team'),
'query_var' => true,
'show_in_rest' => true,
'rest_base' => 'team',
'rest_controller_class' =>'WP_REST_Posts_Controller',
'supports' => array(
'title',
'editor',
'excerpt',
'trackbacks',
'comments',
'revisions',
'thumbnail',
'author',
'page-attributes'
)
);
register_post_type( 'team', $args);
register_taxonomy('product_category', 'team', array('hierarchical' => true, 'label' => 'Category', 'query_var' => true, 'rewrite' => array( 'slug' => 'product-category' )));
}
add_action( 'init', 'team_post_init' );
</div>