Changeset 5937 for trunk/wp-admin/import/wordpress.php
- Timestamp:
- 08/24/2007 02:44:26 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/import/wordpress.php
r5870 r5937 221 221 global $wpdb; 222 222 223 $cat_names = (array) $wpdb->get_col("SELECT cat_name FROM $wpdb->categories");223 $cat_names = (array) get_terms('category', 'fields=names'); 224 224 225 225 while ( $c = array_shift($this->categories) ) { … … 324 324 $post_cats = array(); 325 325 foreach ($categories as $category) { 326 $cat_ID = (int) $wpdb->get_var("SELECT cat_ID FROM $wpdb->categories WHERE cat_name = '$category'"); 326 $slug = sanitize_term_field('slug', $category, 0, 'category', 'db'); 327 $cat = get_term_by('slug', $slug, 'category'); 328 $cat_ID = 0; 329 if ( ! empty($cat) ) 330 $cat_ID = $cat->term_id; 327 331 if ($cat_ID == 0) { 332 $category = $wpdb->escape($category); 328 333 $cat_ID = wp_insert_category(array('cat_name' => $category)); 329 334 }
Note: See TracChangeset
for help on using the changeset viewer.