I am trying to add a new clone (or element) to a cloneable text list with three inputs with the custom table API. This is the text field:
The desired result is this, add a new clone with the values in all inputs:
I am using this code but does not work. I think that I am not building correctly the "$data" array:
function add_product_register() {
$exists = false;
$table_name = "cmp_customfields";
$post_id = 17;
$exists = \MetaBox\CustomTable\API::exists($post_id, $table_name);
if ($exists){
$data = [
'id_of_text_list' => ["date2", "price2", "name2"],
];
\MetaBox\CustomTable\API::add($post_id, $table_name, $data);
}
}
Thank you in advance!