回答編集履歴

1

リライトルールのサンプルを追加

2018/08/27 09:11

投稿

marlboro_tata
marlboro_tata

スコア525

test CHANGED
@@ -11,3 +11,29 @@
11
11
 
12
12
 
13
13
  それが確認できたら、あとはリライトルールを追加すれば良いような気がします。
14
+
15
+
16
+
17
+ テーマのfunctions.phpに下記を追加
18
+
19
+
20
+
21
+ ```PHP
22
+
23
+ function authorUrlRewrite(){
24
+
25
+ add_rewrite_rule('^hoge/author/([^/]*)/?$' , 'index.php?post_type=hoge&author_name=$matches[1]','top');
26
+
27
+ }
28
+
29
+ add_action( 'init', 'authorUrlRewrite' );
30
+
31
+ ```
32
+
33
+
34
+
35
+ 適用するには、functions.phpをアップロード後、
36
+
37
+ 設定>パーマリンク設定 を開いて何もしないで変更を保存ボタンを押す。
38
+
39
+ ドメイン以下に /hoge/author/username/ で、投稿の一覧が表示されるはずです。