サポート » 使い方全般 » カスタム投稿タイプのパーマリンク階層構造

  • カスタム投稿タイプの、カスタムタクソノミー、タームの多階層を使った際のパーマリンク構造について質問です。

    以下の様なURLにしたいのですが、子タームのみ404になってしまいます。
    http://example.com/カスタム投稿タイプ名/親ターム名/子ターム名/記事スラッグ

    ※現在の作業環境は「ローカル環境」「xampp」「wordpressマルチサイト化」です。

    カスタム投稿タイプ、タクソノミー、パーマリンクの設定は以下の通りです。

    add_action( 'init', 'custum_post_type', 0 );
    function custum_post_type() {
        //ここからカスタム投稿追加
        register_post_type( 'test',
            array('labels' =>
    			array(
    				'name' => __( '施術情報' ),
                    'singular_name' => __( '施術情報' ),
    				'add_new' => _x('施術を追加', 'test'),
                    'add_new_item' => __('新しい施術を追加'),
    				'edit_item' => __('施術を編集'),
    				'new_item' => __('新しい施術情報'),
    				'view_item' => __('施術を編集'),
    				'search_items' => __('施術を探す'),
    				'not_found' => __('施術はありません'),
    				'not_found_in_trash' => __('ゴミ箱にはありません'),
    				'parent_item_colon' => ''
    			),
                'public' => true,
                'menu_position' => 5,
                'hierarchical' => false,
                'has_archive' => true,
                'publicly_queryable' => true,
                'show_ui' => true,
                'query_var' => true,
                'rewrite' => array('slug' => 'test', 'with_front' => true, 'hierarchical' => true),
                'capability_type' => 'post',
    			'taxonomies' => array('test_cate'),
                'supports' => array('title','editor','thumbnail')
            )
        );
    
        register_taxonomy(
            'test_cate',
            'test',
    			array(
    				'public' => true,
    				'show_ui' => true,
    				'hierarchical' => true,
    				'label' => 'testカテゴリ',
    				'singular_label' => 'testカテゴリ',
    				'query_var' => true,
    				'rewrite' => array('slug' => 'test', 'with_front' => true, 'hierarchical' => true)
    			)
    	);
    
    }

    ■Custom Post Type Permalinks(バージョン 2.2.0)
    /%test_cate%/%postname%
    カスタム分類のアーカイブのパーマリンクを変更する・Add post_type query for custom taxonomy archive→ともにチェックなし

    ■使用テンプレート
    archive-test.php/taxonomy-test_cate.php/single-test.php

    ご教示いただけると幸いです。
    よろしくお願いします。

  • トピック「カスタム投稿タイプのパーマリンク階層構造」には新たに返信することはできません。