2008年8月10日の投稿
2008-08-10

WP 2.6 にしたらカテゴリー/タグ URL が変わってしまった
WordPress 2.6 へのアップグレードを見送っていた当サイトですが、一足飛びに、WordPress 2.6.1 ベータ版にアップグレードしました。2.6 正式版よりもバグが少ないとにらんでのことです
しかし、困った問題が発生しました。それは、カテゴリー URL が「http://www.yuriko.net/cat/ほげほげ/」→「http://www.yuriko.net/arc/cat/ほげほげ/」に変わってしまったことです。タグ URL も同様に「arc/」がついてしまいます。これは、パーマリンク構造を「/arc/%year%/%monthnum%/%day%/%postname%/」にしているために、先頭にある「/arc/」をカテゴリー URL、タグ URL にも補完してしまっているのでしょう。この挙動は不可思議なので、元に戻してもらいたいですよね……。さっそくチケット #7490を切りましたが、2.6.1 リリースまでに直してもらえるんでしょうか……。当面は、mod_rewrite かリダイレクトで逃げるしかなさそうですが。
[追記] ウチのサイトは「URL を変えない」ことが信条なのに、ソフトウェアの都合で URL 体系を変えられたら、たまったものではありません。とりあえず、wp-includes/rewrite.php をいじって元に戻しました。
450,451c450,454 < $this->category_base = 'category'; < $this->category_structure = trailingslashit( $this->front . $this->category_base ); --- > $this->category_structure = $this->front . 'category/'; > else > $this->category_structure = '/' . $this->category_base . '/'; > // $this->category_base = 'category'; > // $this->category_structure = trailingslashit( $this->front . $this->category_base ); 469,470c472,476 < $this->tag_base = 'tag'; < $this->tag_structure = trailingslashit( $this->front . $this->tag_base ); --- > $this->tag_structure = $this->front . 'tag/'; > else > $this->tag_structure = '/' . $this->tag_base . '/'; > // $this->tag_base = 'tag'; > // $this->tag_structure = trailingslashit( $this->front . $this->tag_base );
[追記] 2.6.1 ベータ2で直りました。パーマリンク構造が /archives/%post_id% の場合でも同じ不具合が発生しますから、わりと重度な不具合だったと言えます。