My brain has fallen over. How do I save this post data? Building some key-value pairs in the form.
for ($i = 1; $i <= 3; $i++) {
$saved = $meta[$i];
//print_r($saved);
//echo $saved['key'];
echo '<p>';
echo '<label for="meta_k_'.$i.'">Key</label> ', '<input id="meta_k_'.$i.'" type="text" name="_meta['.$i.'][key]" value="'.$saved['key'].'" /> ';
echo '<label for="meta_v_'.$i.'">Value</label> ', '<input id="meta_v_'.$i.'" type="text" name="_meta['.$i.'][value]" value="'.$saved['value'].'" />';
echo '</p>';
}
How do I save them???
foreach ($_POST['_meta'] as $key => $value) {
update_post_meta($post_id, $key, $value);
}