Use cat_name instead of cat_nicename when creating categories from import. Props takayukister. fixes #4040

git-svn-id: https://develop.svn.wordpress.org/trunk@5246 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
rob1n 2007-04-12 01:49:46 +00:00
parent e58cfd6981
commit f9ab937ce7
1 changed files with 13 additions and 4 deletions

View File

@ -288,11 +288,20 @@ class WP_Import {
// Memorize old and new ID.
if ( $post_id && $post_ID && $this->posts_processed[$post_ID] )
$this->posts_processed[$post_ID][1] = $post_id; // New ID.
// Add categories.
if ( 0 != count($categories) )
wp_create_categories($categories, $post_id);
if (count($categories) > 0) {
$post_cats = array();
foreach ($categories as $category) {
$cat_ID = (int) $wpdb->get_results("SELECT * FROM $wpdb->categories WHERE cat_name = '$category'");
if ($cat_ID == 0) {
if ($cat_ID = wp_insert_category(array('cat_name' => $category))) {
$post_cats[] = $cat_ID;
}
}
}
wp_set_post_categories($post_ID, $post_cats);
}
}
// Now for comments