WordPress.org

Ready to get started?Download WordPress

Forums

Can't save meta box input (3 posts)

  1. robahas
    Member
    Posted 1 month ago #

    Hi - I'm making post meta boxes and I am stuck on the update piece. There is no sign of my meta en the database and I can't see what is wrong with my code:

    add_action ('save_post', 'rah_save_page_meta');
    function rah_save_page_meta($post_ID) {
    update_post_meta( $post_ID, '_single-page-footer-text-1', $_POST['single-page-footer-text-1'] );
    }

    the data is collected from here, in the add_meta_box defined function:

    <textarea style="width:50%; min-height:100px;" name="single-page-footer-text-1"><?php echo get_post_meta( $post->ID, '_single-page-footer-text-1', true ); ?></textarea>

    I don't have to add the save_post action from within any other function do I?

  2. bcworkz
    Member
    Posted 1 month ago #

    No, add_action() can be executed when your script page loads, as you have it now. There's nothing wrong with the code you posted. I added your text area to my existing meta box and your save_post callback works fine. Whatever is wrong lies elsewhere.

  3. itrong
    Member
    Posted 1 month ago #

    How to do not show author on Quicedit button on post page . my site http://www.itrongbd.com

Reply

You must log in to post.

About this Topic