質問編集履歴
1
文章を編集しました。
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
Custom Post Type UI
|
1
|
+
Custom Post Type UI カスタムリライトスラッグ使用時の404エラーについて
|
test
CHANGED
@@ -6,23 +6,21 @@
|
|
6
6
|
|
7
7
|
### 前提
|
8
8
|
|
9
|
-
Custom Post Type UI でカスタム投稿タイプ
|
9
|
+
Custom Post Type UI でカスタム投稿タイプを作り、
|
10
10
|
|
11
11
|
カスタムリライトスラッグを
|
12
12
|
|
13
|
-
○○○/
|
13
|
+
○○○/カスタム投稿タイプ
|
14
14
|
|
15
15
|
としています。
|
16
16
|
|
17
17
|
|
18
18
|
|
19
|
-
タクソノミー(aaacat)も作成し、
|
20
|
-
|
21
|
-
親ターム
|
19
|
+
カスタムタクソノミーも作成し、親タームと子タームを作成しました。
|
22
20
|
|
23
21
|
|
24
22
|
|
25
|
-
### 発生している問題
|
23
|
+
### 発生している問題
|
26
24
|
|
27
25
|
|
28
26
|
|
@@ -30,9 +28,9 @@
|
|
30
28
|
|
31
29
|
|
32
30
|
|
33
|
-
https://example.com/○○○/
|
31
|
+
https://example.com/○○○/カスタム投稿タイプ/親ターム/ → OK
|
34
32
|
|
35
|
-
https://example.com/○○○/
|
33
|
+
https://example.com/○○○/カスタム投稿タイプ/親ターム/子ターム/ → 404エラー
|
36
34
|
|
37
35
|
|
38
36
|
|
@@ -40,15 +38,19 @@
|
|
40
38
|
|
41
39
|
|
42
40
|
|
43
|
-
taxonomy.php
|
41
|
+
この問題の前にtaxonomy.php が404エラーとなっていたので、[こちら](https://teratail.com/questions/158663)の記事を参考に、Custom Post Type UIからソースを取り出し、function.phpに貼り付け、該当箇所に下記を追加しました。
|
44
42
|
|
45
43
|
|
46
44
|
|
47
|
-
add_rewrite_rule('○○○/
|
45
|
+
add_rewrite_rule('○○○/カスタム投稿タイプ/([^/]+)/?$', 'index.php?カスタムタクソノミー=$matches[1]', 'top');
|
48
46
|
|
49
47
|
|
50
48
|
|
49
|
+
これでtaxonomy.phpの404エラーは解消されたのですが、今度はshingle.phpが...という状況です。
|
50
|
+
|
51
|
+
|
52
|
+
|
51
|
-
|
53
|
+
色々検索しても分からず困っております。
|
52
54
|
|
53
55
|
どなたかお力を貸して頂けないでしょうか。
|
54
56
|
|