function ft_save_meta_box_data($post_id)
{
    /*
     * We need to verify this came from our screen and with proper authorization,
     * because the save_post action can be triggered at other times.
     */
    // Check if our nonce is set.
    if (!isset($_POST['ft_meta_box_nonce'])) {
        return;
    }
    // Verify that the nonce is valid.
    if (!wp_verify_nonce($_POST['ft_meta_box_nonce'], 'ft_meta_box')) {
        return;
    }
    // If this is an autosave, our form has not been submitted, so we don't want to do anything.
    if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
        return;
    }
    // Check the user's permissions.
    if (isset($_POST['post_type']) && 'page' == $_POST['post_type']) {
        if (!current_user_can('edit_page', $post_id)) {
            return;
        }
    } else {
        if (!current_user_can('edit_post', $post_id)) {
            return;
        }
    }
    /* OK, it's safe for us to save the data now. */
    // Sanitize user input.
    update_post_meta($post_id, 'family_tree', $_POST['family_tree']);
    update_post_meta($post_id, 'member1', $_POST['member1']);
    update_post_meta($post_id, 'member2', $_POST['member2']);
    update_post_meta($post_id, 'relation_type', $_POST['relation_type']);
    update_post_meta($post_id, 'member1_role', $_POST['member1_role']);
    update_post_meta($post_id, 'member2_role', $_POST['member2_role']);
    $my_post = array('ID' => $post_id, 'post_title' => ft_get_member_name($_POST['member1']) . ' is ' . ft_get_role_title($_POST['member1_role']) . ' of ' . ft_get_member_name($_POST['member2']));
    // unhook this function so it doesn't loop infinitely
    remove_action('save_post', 'ft_save_meta_box_data');
    // update the post, which calls save_post again
    wp_update_post($my_post);
    // re-hook this function
    add_action('save_post', 'ft_save_meta_box_data');
    write_family_json_file($_POST['family_tree']);
}
function ft_update_json($postid)
{
    // We check if the global post type isn't ours and just return
    global $post_type;
    if ($post_type != 'ft_relation') {
        return;
    }
    write_family_json_file(get_post_meta($postid, 'family_tree', true));
}