}
            if (isset($new_data['custom_field_defs'][$fieldname])) {
                $fieldname++;
            }
            if (isset($new_data['custom_field_defs'][$fieldname])) {
                $fieldname++;
            }
            $custom_fields_this_post_type[] = $fieldname;
            $field_def['name'] = $fieldname;
            $new_data['custom_field_defs'][$fieldname] = $field_def;
        }
        $data[$post_type]['custom_fields'] = $custom_fields_this_post_type;
        // Alert users to the fact that they may have to change their templates!!!
        if ($fieldname != $original_fieldname) {
            $msg = sprintf(__("You may have to change your template for the %s post_type! Any instances of get_custom_field('%s') or print_custom_field('%s') in the single-%s.php file should be replaced with get_custom_field('%s') or print_custom_field('%s').  You may also use the 'Custom Fields-->Merge' command to merge field definitions.", CCTM_TXTDOMAIN), $post_type, $original_fieldname, $original_fieldname, $post_type, $fieldname, $fieldname);
            CCTM::register_warning($msg);
            // update database
            global $wpdb;
            $wpdb->prepare("UPDATE \n                    {$wpdb->postmeta} postmeta INNER JOIN {$wpdb->posts} posts\n                    SET postmeta.meta_key = %s\n                    WHERE\n                    posts.post_type = %s \n                    AND\n                    postmeta.meta_key = %s", $fieldname, $post_type, $original_fieldname);
        }
    }
}
// post_type loop
$new_data['post_type_defs'] = $data;
//print_r($new_data); exit;
update_option(self::db_key, $new_data);
// stick it in the db
self::$data = $new_data;
// and stick it in memory just to be sure
delete_option('custom_content_types_mgr_data');
// legacy pre 0.9.4