MyCategoryOrder の 子カテゴリの並び替えが反映されない現象に対処

WordPress を 2.3.2 にアップデートした後に、My Category Order の子カテゴリの並び順が範囲されていないので、対応してみました。

とりあえず、プラグイン配布ページにて、mycategoryorder2-3-2.zip というファイルが、 2.3.2 対応で配布されていたので、それに入れ替えてみましたが改善せず。というか、これよりも 2.3対応版っぽう mycategoryorder2-3.zip の方がタイプスタンプが新しいというのはいったい?

対応策がないのかなとコメント欄を眺めていたら、コメント に修正の投稿がありました。こちらのパッチを、mycategoryorder2-3-2.zip 内の mycategoryorder.php に当ててやれば直りました。ということで、パッチは以下。

パッチ

$ diff -u mycategoryorder.php.org  mycategoryorder.php
--- mycategoryorder.php.org     2007-09-30 17:24:48.000000000 +0900
+++ mycategoryorder.php 2008-01-08 14:48:35.000000000 +0900
@@ -55,14 +55,11 @@
        {
            $subCatStr = "";
 
-               $results=$wpdb->get_results("SELECT DISTINCT t.term_id, name FROM $wpdb->term_taxonomy tt inner join $wpdb->term_relationships tr on tt.term_taxonomy_id = tr.term_taxonomy_id inner join $wpdb->terms t on t.term_id = tt.term_id where taxonomy = 'link_category' and tt.parent = $parentID ORDER BY term_order ASC");
-           foreach($results as $row)
-           {
-                       $catCount=$wpdb->get_row("SELECT count(*) as catCount FROM $wpdb->term_taxonomy WHERE taxonomy = 'category' and parent = $row->term_id ", ARRAY_N);
-       
-                       if($catCount[0] > 0)
-                               $subCatStr = $subCatStr."<option value='$row->term_id'>$row->name</option>";
-           }
+$results=$wpdb->get_results("SELECT t.term_id, t.name FROM $wpdb->term_taxonomy tt, $wpdb->terms t, $wpdb->term_taxonomy tt2 WHERE tt.parent = $parentID AND tt.taxonomy = 'category' AND t.term_id = tt.term_id AND tt2.parent = tt.term_id GROUP BY t.term_id, t.name HAVING COUNT(*) > 1 ORDER BY t.term_order ASC");
+foreach($results as $row)
+{
+$subCatStr = $subCatStr."<option value='$row->term_id'>$row->name</option>";
+}
 ?>
        <div class='wrap'>
        <h2>My Category Order</h2>