In your save code, the value of $field['id']
is event_timeframe
, which does not exist in $_POST
, so your options will never save.
You need to dig down into your options
array to get to timestart
and timeend
:
// loop through fields and save the data
foreach ( $event_infobox_fields as $field ) {
foreach ( $field['options'] as $option_key => $option_value ) {
$old = get_post_meta( $post_id, $option_key, true );
$new = $_POST[$option_key];
if ( $new && $new != $old ) {
update_post_meta( $post_id, $option_key, $new );
} elseif ( '' == $new && $old ) {
delete_post_meta( $post_id, $option_key, $old );
}
} // end foreach
}
Bear in mind that you will also have to update the meta used in your dropdown code in order to pre-populate those.