WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Meta box not updating/saving (2 posts)

  1. m4monkey
    Member
    Posted 1 year ago #

    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'])
    );
    }
    });
    }
    `

  2. m4monkey
    Member
    Posted 1 year ago #

    Sorted

Topic Closed

This topic has been closed to new replies.

About this Topic