My meta box (custom fields) won't save…
-
Hi,
I don’t understand which mistake I’ve done. I’ve created a custom post type and I have also set a custom field for them. But I can’t save the custom field, here is my code (I’m not a programmer)… anyone can help me?
add_action( 'add_meta_boxes', 'custom_field_tetti' ); function custom_field_tetti(){ add_meta_box("specifiche_tetti_meta", "Specifiche Tetti", "specifiche_tetti", "tetti", "normal", "high" ); } function specifiche_tetti(){ global $post; $custom_seriale = get_post_custom($post->ID); $tetti_seriale = $custom_seriale["tetti_seriale"][0]; ?> <label>Seriale:</label> <input name="tetti_seriale" value="<?php echo $tetti_seriale; ?>"/> <?php } //SALVO I CAMPI PRESONALIZZATI DEL CUSTOM POST TYPE TETTI add_action('save_post', 'save_specifiche_tetti'); global $post; function save_specifiche_tetti(){ update_post_meta($post->ID, "tetti_seriale", $_POST["tetti_seriale"]); } ?>
- The topic ‘My meta box (custom fields) won't save…’ is closed to new replies.