Title: カスタム投稿タイプを複数作る方法
Last modified: 2011年8月8日

---

# カスタム投稿タイプを複数作る方法

 *  解決済 [isseiaone](https://ja.wordpress.org/support/users/isseiaone/)
 * (@isseiaone)
 * [15年、 3ヶ月前](https://ja.wordpress.org/support/topic/%e3%82%ab%e3%82%b9%e3%82%bf%e3%83%a0%e6%8a%95%e7%a8%bf%e3%82%bf%e3%82%a4%e3%83%97%e3%82%92%e8%a4%87%e6%95%b0%e4%bd%9c%e3%82%8b%e6%96%b9%e6%b3%95/)
 * こんにちは。
 * カスタム投稿を複数作ることが出来ずに困っています。
    現在下記のような記述をfunctions.
   phpに書き込んでカスタム投稿を1つ追加しました。
 *     ```
       /*** bbd-カスタム投稿01 ***/
       add_action( 'init', 'create_post_type' );
       function create_post_type() {
           register_post_type( 'jirei01',
               array(
               'labels' => array(
               'name' => __( '一般住宅事例' ),
               'singular_name' => __( '一般住宅事例' )
               ),
               'public' => true,
               'has_archive' => true,
               'menu_position' => 5,
               )
           );
       }
       ```
   
 * 更にもう1つカスタム投稿を増やしたく、下記のようにfunctions.phpに上記記述をそのまま
   コピーしてポストタイプ名等を変更して上記記述の真下にペーストしアップデートしま
   した。
 *     ```
       /*** bbd-カスタム投稿01 ***/
       add_action( 'init', 'create_post_type' );
       function create_post_type() {
           register_post_type( 'jirei01',
               array(
               'labels' => array(
               'name' => __( '一般住宅事例' ),
               'singular_name' => __( '一般住宅事例' )
               ),
               'public' => true,
               'has_archive' => true,
               'menu_position' => 5,
               )
           );
       }
       /*** bbd-カスタム投稿02 ***/
       add_action( 'init', 'create_post_type' );
       function create_post_type() {
           register_post_type( 'jirei02',
               array(
               'labels' => array(
               'name' => __( '事務所店舗事例' ),
               'singular_name' => __( '事務所店舗事例' )
               ),
               'public' => true,
               'has_archive' => true,
               'menu_position' => 5,
               )
           );
       }
       ```
   
 * すると何故か管理画面が真っ白になって何も見えなくなってしまいます。
    二つ目の記述
   を削除して一つだけのカスタム投稿の状態に戻すと管理画面は 正常に表示されます。
 * 二つ目以降のカスタム投稿の記述はどうしたらいいのでしょうか。
    是非お力添えよろしく
   お願いします。

2件の返信を表示中 - 1 - 2件目 (全2件中)

 *  [y_yu](https://ja.wordpress.org/support/users/y_yu/)
 * (@y_yu)
 * [15年、 3ヶ月前](https://ja.wordpress.org/support/topic/%e3%82%ab%e3%82%b9%e3%82%bf%e3%83%a0%e6%8a%95%e7%a8%bf%e3%82%bf%e3%82%a4%e3%83%97%e3%82%92%e8%a4%87%e6%95%b0%e4%bd%9c%e3%82%8b%e6%96%b9%e6%b3%95/#post-141275)
 * PHPでは同名のfunctionを再定義できないので、二つ目の下記個所でエラーになっている
   のだと思います。
 * `function create_post_type() {`
 * なので、create_post_type()の名前（add_action内も）をそれぞれ変えれば動くと思い
   ます。
 * 詳しく分からないのであれば、Custom Post Type UIという便利なプラグインがあります
   ので、特別な理由が無ければ（多言語対応の記述が出来るかあやしい）、個人的にはそちら
   の使用をおすすめします。
 * [http://wordpress.org/extend/plugins/custom-post-type-ui/](http://wordpress.org/extend/plugins/custom-post-type-ui/)
 *  [mamicha315](https://ja.wordpress.org/support/users/mamicha315/)
 * (@mamicha315)
 * [14年、 1ヶ月前](https://ja.wordpress.org/support/topic/%e3%82%ab%e3%82%b9%e3%82%bf%e3%83%a0%e6%8a%95%e7%a8%bf%e3%82%bf%e3%82%a4%e3%83%97%e3%82%92%e8%a4%87%e6%95%b0%e4%bd%9c%e3%82%8b%e6%96%b9%e6%b3%95/#post-141439)
 *     ```
       add_action( 'init', 'create_post_type' );
       function create_post_type() {
           register_post_type( 'jirei01',
               array(
               'labels' => array(
               'name' => __( '一般住宅事例' ),
               'singular_name' => __( '一般住宅事例' )
               ),
               'public' => true,
               'has_archive' => true,
               'menu_position' => 5,
               )
           );
   
           register_post_type( 'jirei02',
               array(
               'labels' => array(
               'name' => __( '事務所店舗事例' ),
               'singular_name' => __( '事務所店舗事例' )
               ),
               'public' => true,
               'has_archive' => true,
               'menu_position' => 5,
               )
           );
       }
       ```
   

2件の返信を表示中 - 1 - 2件目 (全2件中)

 トピック「カスタム投稿タイプを複数作る方法」には新たに返信することはできません。

 * フォーラム: [使い方全般](https://ja.wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2件の返信
 * 3人の参加者
 * 最後の返信者: [mamicha315](https://ja.wordpress.org/support/users/mamicha315/)
 * 最後の活動: [14年、 1ヶ月前](https://ja.wordpress.org/support/topic/%e3%82%ab%e3%82%b9%e3%82%bf%e3%83%a0%e6%8a%95%e7%a8%bf%e3%82%bf%e3%82%a4%e3%83%97%e3%82%92%e8%a4%87%e6%95%b0%e4%bd%9c%e3%82%8b%e6%96%b9%e6%b3%95/#post-141439)
 * 状態: 解決済

## トピック

### 人気のトピック

### 返信がないトピック

### サポート関連ではないトピック

### 解決済みのトピック

### 未解決のトピック

### すべてのトピック
