Leave a Reply

1 comment

  1. If that is all of your code, you’re missing a save_post action to save the data. Refer to the code sample provided on add_meta_box.

    add_action( 'save_post', 'save_my_meta_box_data' );
    
    function save_my_meta_box_data( $post_id ){
        // make sure it's not an autosave
        if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) 
            return;
    
        // verify your nonce
        if ( !wp_verify_nonce( $_POST['my_noncename'], 'my-nonce' ) )
            return;
    
        // check post type, permissions
        // validate your $_POST data
        // update_post_meta();
    }