Tag Info

New answers tagged

0

I was literally banging my head around a related issue and this is the first thing I've read online that gave a solid pointer to what I was doing wrong. Turns out add_meta_boxes is called later than save_post, so you'd need to set up the save hook BEFORE the metabox is created. Seems counter-intuitive at first, but the markup is typically generated AFTER ...


0

$myterms = get_terms($taxonomies, $args); returns an array of term objects. Use $term->term_id as option value … "<option value='$term->term_id'>". esc_html( $term_name ) . "</option>" … and store that ID, not the name. Names can change, the IDs will stay the same – unless someone deletes a term and creates a new one with the same name. ...


1

Did you check the database for the data? My guess is that the problem is here: echo '<input type="checkbox" name="cbn[]" id="'.$option['value'].'"',$checkboxes && in_array($option['value'], $checkboxes) ? ' checked="checked"' : '',' /> '; should be: echo '<input type="checkbox" name="cbn[]" id="'.$option['value'].'"'.$checkboxes ...


2

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 => ...



Top 50 recent answers are included