回答編集履歴
1
ソースの修正
test
CHANGED
@@ -28,11 +28,51 @@
|
|
28
28
|
|
29
29
|
add_action('init', function(){
|
30
30
|
|
31
|
-
|
31
|
+
global $wp_rewrite;
|
32
32
|
|
33
|
-
|
33
|
+
$wp_rewrite->comments_pagination_base = 'comments';
|
34
34
|
|
35
|
+
});
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
add_filter('rewrite_rules_array',function ($rules){
|
40
|
+
|
41
|
+
$newrules = array();
|
42
|
+
|
43
|
+
|
44
|
+
|
35
|
-
|
45
|
+
$newrules['(.?.+?)/comments/([0-9]{1,})/?$'] = 'index.php?pagename=$matches[1]&cpage=$matches[2]';
|
46
|
+
|
47
|
+
$newrules['(.?.+?)/comments/([0-9]{1,})/?$'] = 'index.php?pagename=$matches[1]&cpage=$matches[2]';
|
48
|
+
|
49
|
+
$newrules['game/[^/]+/attachment/([^/]+)/comments/?([0-9]{1,})/?$'] = 'index.php?attachment=$matches[1]&cpage=$matches[2]';
|
50
|
+
|
51
|
+
$newrules['game/([^/]+)/comments/?([0-9]{1,})/?$'] = 'index.php?game=$matches[1]&cpage=$matches[2]';
|
52
|
+
|
53
|
+
$newrules['game/[^/]+/([^/]+)/comments/?([0-9]{1,})/?$'] = 'index.php?attachment=$matches[1]&cpage=$matches[2]';
|
54
|
+
|
55
|
+
$newrules['.*wp-(atom|rdf|rss|rss2|feed|commentsrss2).php$'] = 'index.php?feed=old';
|
56
|
+
|
57
|
+
$newrules['comments/feed/(feed|rdf|rss|rss2|atom)/?$'] = 'index.php?&feed=$matches[1]&withcomments=1';
|
58
|
+
|
59
|
+
$newrules['comments/(feed|rdf|rss|rss2|atom)/?$'] = 'index.php?&feed=$matches[1]&withcomments=1';
|
60
|
+
|
61
|
+
$newrules['comments/embed/?$'] = 'index.php?&embed=true';
|
62
|
+
|
63
|
+
$newrules['.?.+?/attachment/([^/]+)/comments/?([0-9]{1,})/?$'] = 'index.php?attachment=$matches[1]&cpage=$matches[2]';
|
64
|
+
|
65
|
+
$newrules['(.?.+?)/comments/?([0-9]{1,})/?$'] = 'index.php?pagename=$matches[1]&cpage=$matches[2]';
|
66
|
+
|
67
|
+
$newrules['[^/]+/attachment/([^/]+)/comments/?([0-9]{1,})/?$'] = 'index.php?attachment=$matches[1]&cpage=$matches[2]';
|
68
|
+
|
69
|
+
$newrules['([^/]+)/comments/?([0-9]{1,})/?$'] = 'index.php?name=$matches[1]&cpage=$matches[2]';
|
70
|
+
|
71
|
+
$newrules['[^/]+/([^/]+)/comments/?([0-9]{1,})/?$'] = 'index.php?attachment=$matches[1]&cpage=$matches[2]';
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
return $newrules + $rules;
|
36
76
|
|
37
77
|
});
|
38
78
|
|
@@ -42,7 +82,7 @@
|
|
42
82
|
|
43
83
|
if (preg_match( '{(.?.+?)/comments-([0-9]{1,})/}', $result, $m)) {
|
44
84
|
|
45
|
-
$result = $m[1] . '/comments/' . $m[2];
|
85
|
+
$result = $m[1] . '/comments/' . $m[2].'/';
|
46
86
|
|
47
87
|
return $result;
|
48
88
|
|
@@ -58,9 +98,13 @@
|
|
58
98
|
|
59
99
|
if ( $type_of_url === 'commentpaged' ) {
|
60
100
|
|
61
|
-
if (preg_match( '{comments/}', $string)) {
|
101
|
+
if (preg_match( '{(.?.+?)/comments-([0-9]{1,})/}', $string, $m)) {
|
62
102
|
|
103
|
+
$result = $m[1] . '/comments/' . $m[2].'/';
|
104
|
+
|
63
|
-
return $st
|
105
|
+
return $result;
|
106
|
+
|
107
|
+
|
64
108
|
|
65
109
|
}else{
|
66
110
|
|