Hi,
i've successfully created a new custom table named 'collaborateur_table' with some fields.
I've a custom post type named 'collaborateur' with fields created like that :
function get_meta_box_collaborateur( $meta_boxes ) {
$meta_boxes[]= array(
'id' => 'creation_collaborateur',
'title' => esc_html__( 'Fiche collaborateur', 'textdomain' ),
'post_types' => array( 'collaborateur' ),
'context' => 'advanced',
'priority' => 'default',
'autosave' => false,
'storage_type' => 'custom_table',
'table' => 'collaborateur_table', // my custom table name
'fields' => array(
array(
'id' => 'title',
'type' => 'text',
'name' => esc_html__( 'title', 'textdomain' ),
),
array(
'id' => 'nom',
'type' => 'text',
'name' => esc_html__( 'Nom', 'textdomain' ),
),
[ etc...]
),
);
return $meta_boxes;
}
add_filter( 'rwmb_meta_boxes', 'get_meta_box_collaborateur' );
Everything is correctly displayed
But when i publish a new post type 'collaborateur', only the title is registered in the wp_posts
table. No new entries is registered in my custom_table.
Did I forget something to be able to save my custom fields in my new table ?