Skip to content

Commit a1c68a2

Browse files
authored
Merge pull request #2 from WordPress/fix/support-for-wp-6-1
Add support for WordPress 6.1
2 parents 28efec9 + 4d338f6 commit a1c68a2

File tree

2 files changed

+27
-11
lines changed

2 files changed

+27
-11
lines changed

readme.txt

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
=== Categories to Tags Converter ===
22
Contributors: wordpressdotorg
3-
Donate link:
3+
Donate link:
44
Tags: importer, categories and tags converter
55
Requires at least: 3.0
6-
Tested up to: 4.1
7-
Stable tag: 0.5
6+
Tested up to: 6.1
7+
Stable tag: 0.6
88
License: GPLv2 or later
99
License URI: http://www.gnu.org/licenses/gpl-2.0.html
1010

@@ -22,8 +22,20 @@ Convert existing categories to tags or tags to categories, selectively.
2222

2323
== Changelog ==
2424

25+
= 0.6 =
26+
* Add support for WordPress 6.1
27+
2528
= 0.5 =
26-
* Fix issue where WordPress could not load the importer.
29+
* Fix issue where WordPress could not load the importer
30+
31+
= 0.4 =
32+
* Fixes #WP13460
33+
34+
= 0.3 =
35+
* Change handle to match plugin slug
36+
37+
= 0.2 =
38+
* Add WP_LOAD_IMPORTERS check
2739

2840
= 0.1 =
2941
* Initial release

wpcat2tag-importer.php

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
Description: Convert existing categories to tags or tags to categories, selectively.
66
Author: wordpressdotorg
77
Author URI: http://wordpress.org/
8-
Version: 0.5.2
8+
Version: 0.6
99
License: GPL version 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
1010
*/
1111

@@ -54,7 +54,11 @@ function header( $current_tab ) {
5454
$tabs['formats'] = array( 'label' => __( 'Formats', 'wpcat2tag-importer' ), 'url' => admin_url( 'admin.php?import=wpcat2tag&tab=formats' ) ); ?>
5555

5656
<div class="wrap">
57-
<?php screen_icon(); ?>
57+
<?php
58+
if ( version_compare( get_bloginfo( 'version' ), '3.8.0', '<' ) ) {
59+
screen_icon();
60+
}
61+
?>
5862
<h2><?php _e( 'Categories, Tags and Formats Converter', 'wpcat2tag-importer' ); ?></h2>
5963
<h3 class="nav-tab-wrapper">
6064
<?php foreach ( $tabs as $tab => $info ) :
@@ -248,7 +252,7 @@ function convert_formats() {
248252
$convert_to = 'tag' == $_POST['convert_to'] ? 'post_tag' : 'category';
249253
if ( ! $term_info = term_exists( $_POST['convert_to_slug'], $convert_to ) )
250254
$term_info = wp_insert_term( $_POST['convert_to_slug'], $convert_to );
251-
255+
252256
if ( is_wp_error($term_info) ) {
253257
echo '<p>' . $term_info->get_error_message() . ' ';
254258
printf( __( 'Please <a href="%s">try again</a>.', 'wpcat2tag-importer' ), 'admin.php?import=wpcat2tag&amp;tab=cats' ) . "</p>\n";
@@ -307,7 +311,7 @@ function convert_categories() {
307311
echo '</div>';
308312
return;
309313
}
310-
314+
311315
$default = get_option( 'default_category' );
312316

313317
if ( ! isset($_POST['convert_to']) || 'format' != $_POST['convert_to'] ) {
@@ -337,7 +341,7 @@ function convert_categories() {
337341
if ( 'post_tag' == $convert_to ) {
338342
if ( ! $term_info = term_exists( $category->slug, 'post_tag' ) )
339343
$term_info = wp_insert_term( $category->name, 'post_tag', array( 'description' => $category->description ) );
340-
344+
341345
if ( is_wp_error($term_info) ) {
342346
echo $term_info->get_error_message() . "</li>\n";
343347
continue;
@@ -351,7 +355,7 @@ function convert_categories() {
351355
$values[] = $wpdb->prepare( "(%d, %d, 0)", $post, $term_info['term_taxonomy_id'] );
352356
clean_post_cache( $post );
353357
}
354-
358+
355359
$wpdb->query( "INSERT INTO {$wpdb->term_relationships} (object_id, term_taxonomy_id, term_order) VALUES " . join(',', $values) );
356360
$wpdb->update( $wpdb->term_taxonomy, array( 'count' => $category->count ), array( 'term_id' => $term_info['term_id'], 'taxonomy' => $convert_to ) );
357361
// otherwise just convert it
@@ -404,7 +408,7 @@ function convert_tags() {
404408
if ( 'category' == $convert_to ) {
405409
if ( ! $term_info = term_exists( $tag->slug, 'category' ) )
406410
$term_info = wp_insert_term( $tag->name, 'category', array( 'description' => $tag->description ) );
407-
411+
408412
if ( is_wp_error($term_info) ) {
409413
echo $term_info->get_error_message() . "</li>\n";
410414
continue;

0 commit comments

Comments
 (0)