Sunday 15 July 2012

Wordpress - How to save multiple select item value from metabox -



Wordpress - How to save multiple select item value from metabox -

i did metabox contains multiple select item takes values custom post type. works i'm unable save it...can help me?

function conduce_palinsesto($post){ ?><p>seleziona il/i conduttore/i</p> <p>tieni premuto ctrl per selezionare piĆ¹ conduttori</p> <?php global $post; echo '<select name="conduce[]" id="conduce" multiple="yes">'; $val = get_post_meta($post->id, 'speaker', true); $q = get_posts('post_type=speaker'); foreach ($q $obj) { echo '<option value="'.$obj->id.'" "checked="checked">'.$obj->post_title.'</option>'; } echo '</select>'; }

this save function...that don't work.

add_action('save_post', 'rb_speaker_save_details'); function rb_speaker_save_details($post_id) { if (defined('doing_autosave') && doing_autosave) { homecoming $post_id; } else { $speak = implode(',', $_post['conduce']); update_post_meta($post_id, 'conduce', speak); } }

for saving info inserted/selected in metabox have utilize save_post action. maybe want have @ metabox example in wp codex.

wordpress save meta-boxes

No comments:

Post a Comment