Meta box not updating/saving
-
Hope someone here can help me before I pull the last bit of hair out of my head..
I have a custom meta box and if I have the text as <input type=”text” then it updates and saves fine, but I need it to be a textarea..
Am I missing something very obvious ?
`function anvendes($post) {
$anvendes = get_post_meta($post->ID, ‘medicin_anvendes’, true);
?><label for=”medicin_anvendes”>Anvendes:</label>
<textarea name=”medicin_anvendes” rows=”10″ cols=”60 “name=”medicin_anvendes” id=”medicin_anvendes” value=”<?php echo esc_attr($anvendes);?>”></textarea>
<?php
}
add_action(‘save_post’, function($id){
if(isset($_POST[‘medicin_anvendes’])){
update_post_meta(
$id,
‘medicin_anvendes’,
strip_tags($_POST[‘medicin_anvendes’])
);
}
});
}
`
- The topic ‘Meta box not updating/saving’ is closed to new replies.