From 6d983b5bb571e4d7c1d4a2b8f87407dc5e015d3c Mon Sep 17 00:00:00 2001 From: ryan Date: Tue, 11 Sep 2007 19:54:19 +0000 Subject: [PATCH] If a category is already a tag, don't put it in the list of categories to convert. fixes #4955 git-svn-id: http://svn.automattic.com/wordpress/trunk@6080 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/import/wp-cat2tag.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/wp-admin/import/wp-cat2tag.php b/wp-admin/import/wp-cat2tag.php index edbf4b5bd4..d71da8a8d1 100644 --- a/wp-admin/import/wp-cat2tag.php +++ b/wp-admin/import/wp-cat2tag.php @@ -16,7 +16,11 @@ class WP_Categories_to_Tags { function populate_all_categories() { global $wpdb; - $this->all_categories = get_categories('get=all'); + $categories = get_categories('get=all'); + foreach ( $categories as $category ) { + if ( !tag_exists($wpdb->escape($category->name)) ) + $this->all_categories[] = $category; + } } function welcome() { @@ -172,7 +176,9 @@ class WP_Categories_to_Tags { function convert_all() { global $wpdb; - $this->categories_to_convert = get_categories('fields=ids&get=all'); + $this->populate_all_categories(); + foreach ( $this->all_categories as $category ) + $this->categories_to_convert[] = $category->term_id; $this->convert_them(); }