Home

読み込み中...

WordPressのネットワーク機能で予約語のblogを使う方法

2010/08/25

このエントリーをはてなブックマークに追加

WordPress3.0からは複数ブログを設置できるようになりました。

ですが、そのブログ名には登録できない名前(いわゆる予約語)があり、もしその予約語で登録しようとすると、以下のようなエラーメッセージが表示されます。

以下の語句は WordPress の機能によって予約されており、ブログ名として使うことはできません: page, comments, blog, files, feed

しかし、この中にあるblogという予約語ですが、実はこれって互換性のために予約語として残してあったとかだったと思うのですよね。だから別に使っても大した問題はなかったはず…ですので使えるようにしちゃいましょう。

バージョン: WordPress 3.0.1 ja

以下、修正点です。

/wp-includes/ms-functions.php

516行目

$illegal_names = array_merge($illegal_names, apply_filters( 'subdirectory_reserved_names', array( 'page', 'comments', 'blog', 'files', 'feed' ) ) );

$illegal_names = array_merge($illegal_names, apply_filters( 'subdirectory_reserved_names', array( 'page', 'comments', 'files', 'feed' ) ) );

/wp-admin/ms-edit.php:

154行目

$subdirectory_reserved_names = apply_filters( 'subdirectory_reserved_names', array( 'page', 'comments', 'blog', 'files', 'feed' ) );

$subdirectory_reserved_names = apply_filters( 'subdirectory_reserved_names', array( 'page', 'comments', 'files', 'feed' ) );

/wp-includes/ms-settings.php

72行目

$reserved_blognames = array( 'page', 'comments', 'blog', 'wp-admin', 'wp-includes', 'wp-content', 'files', 'feed' );

$reserved_blognames = array( 'page', 'comments', 'wp-admin', 'wp-includes', 'wp-content', 'files', 'feed' );

配列から’blog’を取り除いていくだけです。簡単ですね。

Leave a comment