Changeset 5980
- Timestamp:
- 08/29/2007 10:47:07 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/import/wp-cat2tag.php
r5941 r5980 97 97 global $wpdb; 98 98 99 if ( !isset($_POST['cats_to_convert']) || !is_array($_POST['cats_to_convert'])) {99 if ( (!isset($_POST['cats_to_convert']) || !is_array($_POST['cats_to_convert'])) && empty($this->categories_to_convert)) { 100 100 print '<div class="narrow">'; 101 101 print '<p>' . sprintf(__('Uh, oh. Something didn\'t work. Please <a href="%s">try again</a>.'), 'admin.php?import=wp-cat2tag') . '</p>'; 102 102 print '</div>'; 103 return; 103 104 } 104 105 … … 110 111 print '<ul>'; 111 112 112 foreach ( $this->categories_to_convert as $cat_id) {113 foreach ( (array) $this->categories_to_convert as $cat_id) { 113 114 $cat_id = (int) $cat_id; 114 115 115 print '<li>' . __('Converting category') . ' #' . $cat_id . '... ';116 print '<li>' . sprintf(__('Converting category #%s ... '), $cat_id); 116 117 117 118 if (!$this->_category_exists($cat_id)) { … … 120 121 $category =& get_category($cat_id); 121 122 123 if ( tag_exists($wpdb->escape($category->name)) ) { 124 _e('Category is already a tag.'); 125 print '</li>'; 126 continue; 127 } 128 122 129 // Set the category itself to $type from above 123 130 $wpdb->query("UPDATE $wpdb->term_taxonomy SET taxonomy = 'post_tag' WHERE term_id = '{$category->term_id}' AND taxonomy = 'category'"); … … 156 163 global $wpdb; 157 164 158 $ wpdb->query("UPDATE $wpdb->term_taxonomy SET taxonomy = 'post_tag', parent = 0 WHERE taxonomy = 'category'");159 clean_category_cache($category->term_id);165 $this->categories_to_convert = get_categories('fields=ids&get=all'); 166 $this->convert_them(); 160 167 } 161 168
Note: See TracChangeset
for help on using the changeset viewer.