run:R W Run
DIR
2026-03-11 16:18:51
R W Run
DIR
2026-03-11 16:18:52
R W Run
DIR
2026-03-11 16:18:51
R W Run
DIR
2026-03-11 16:18:52
R W Run
DIR
2026-03-11 16:18:52
R W Run
DIR
2026-03-11 16:18:51
R W Run
DIR
2026-03-11 16:18:51
R W Run
DIR
2026-03-11 16:18:51
R W Run
DIR
2026-03-11 16:18:51
R W Run
DIR
2026-03-11 16:18:52
R W Run
DIR
2026-03-11 16:18:52
R W Run
DIR
2026-03-11 16:18:52
R W Run
DIR
2026-03-11 16:18:51
R W Run
DIR
2026-03-11 16:18:52
R W Run
DIR
2026-03-11 16:18:52
R W Run
DIR
2026-03-11 16:18:51
R W Run
DIR
2026-03-11 16:18:52
R W Run
DIR
2026-03-11 16:18:51
R W Run
DIR
2026-03-11 16:18:51
R W Run
DIR
2026-03-11 16:18:51
R W Run
DIR
2026-03-11 16:18:52
R W Run
DIR
2026-03-11 16:18:52
R W Run
DIR
2026-03-11 16:18:52
R W Run
DIR
2026-03-11 16:18:52
R W Run
DIR
2026-03-11 16:18:51
R W Run
DIR
2026-03-11 16:18:52
R W Run
DIR
2026-03-11 16:18:52
R W Run
DIR
2026-03-11 16:18:51
R W Run
DIR
2026-03-11 16:18:51
R W Run
23.8 KB
2026-03-11 16:18:51
R W Run
7.8 KB
2026-03-11 16:18:52
R W Run
36.1 KB
2026-03-11 16:18:51
R W Run
11.9 KB
2026-03-11 16:18:52
R W Run
18.94 KB
2026-03-11 16:18:52
R W Run
7.35 KB
2026-03-11 16:18:52
R W Run
28.6 KB
2026-03-11 16:18:51
R W Run
316 By
2026-03-11 16:18:51
R W Run
12.9 KB
2026-03-11 16:18:51
R W Run
61.02 KB
2026-03-11 16:18:52
R W Run
15 KB
2026-03-11 16:18:51
R W Run
112.05 KB
2026-03-11 16:18:51
R W Run
12.47 KB
2026-03-11 16:18:51
R W Run
15.07 KB
2026-03-11 16:18:52
R W Run
9.84 KB
2026-03-11 16:18:52
R W Run
13.17 KB
2026-03-11 16:18:52
R W Run
33.83 KB
2026-03-11 16:18:51
R W Run
42.63 KB
2026-03-11 16:18:51
R W Run
55.71 KB
2026-03-11 16:18:52
R W Run
12.53 KB
2026-03-11 16:18:51
R W Run
2.55 KB
2026-03-11 16:18:52
R W Run
28.92 KB
2026-03-11 16:18:52
R W Run
539 By
2026-03-11 16:18:51
R W Run
367 By
2026-03-11 16:18:52
R W Run
42.65 KB
2026-03-11 16:18:51
R W Run
401 By
2026-03-11 16:18:51
R W Run
6.61 KB
2026-03-11 16:18:51
R W Run
664 By
2026-03-11 16:18:52
R W Run
20.63 KB
2026-03-11 16:18:51
R W Run
2.18 KB
2026-03-11 16:18:52
R W Run
453 By
2026-03-11 16:18:52
R W Run
457 By
2026-03-11 16:18:51
R W Run
36.83 KB
2026-03-11 16:18:52
R W Run
2.41 KB
2026-03-11 16:18:52
R W Run
8.28 KB
2026-03-11 16:18:51
R W Run
13.89 KB
2026-03-11 16:18:51
R W Run
11.76 KB
2026-03-11 16:18:51
R W Run
2.65 KB
2026-03-11 16:18:51
R W Run
7.43 KB
2026-03-11 16:18:51
R W Run
17.46 KB
2026-03-11 16:18:51
R W Run
5.14 KB
2026-03-11 16:18:52
R W Run
16.7 KB
2026-03-11 16:18:51
R W Run
8.28 KB
2026-03-11 16:18:52
R W Run
2.92 KB
2026-03-11 16:18:52
R W Run
1.32 KB
2026-03-11 16:18:51
R W Run
4.6 KB
2026-03-11 16:18:52
R W Run
11.62 KB
2026-03-11 16:18:52
R W Run
2.5 KB
2026-03-11 16:18:51
R W Run
1.97 KB
2026-03-11 16:18:51
R W Run
11.25 KB
2026-03-11 16:18:52
R W Run
5.32 KB
2026-03-11 16:18:51
R W Run
10.99 KB
2026-03-11 16:18:52
R W Run
68.32 KB
2026-03-11 16:18:51
R W Run
6.34 KB
2026-03-11 16:18:51
R W Run
5.49 KB
2026-03-11 16:18:51
R W Run
1.99 KB
2026-03-11 16:18:52
R W Run
7.02 KB
2026-03-11 16:18:51
R W Run
4.91 KB
2026-03-11 16:18:52
R W Run
16.86 KB
2026-03-11 16:18:51
R W Run
24.23 KB
2026-03-11 16:18:51
R W Run
3.97 KB
2026-03-11 16:18:51
R W Run
47.66 KB
2026-03-11 16:18:51
R W Run
9.22 KB
2026-03-11 16:18:51
R W Run
25.51 KB
2026-03-11 16:18:51
R W Run
198.38 KB
2026-03-11 16:18:52
R W Run
56.65 KB
2026-03-11 16:18:51
R W Run
10.46 KB
2026-03-11 16:18:51
R W Run
10.95 KB
2026-03-11 16:18:52
R W Run
29.26 KB
2026-03-11 16:18:51
R W Run
70.91 KB
2026-03-11 16:18:52
R W Run
35.3 KB
2026-03-11 16:18:52
R W Run
16.61 KB
2026-03-11 16:18:52
R W Run
2.57 KB
2026-03-11 16:18:52
R W Run
39.83 KB
2026-03-11 16:18:51
R W Run
70.64 KB
2026-03-11 16:18:51
R W Run
15.56 KB
2026-03-11 16:18:52
R W Run
7.33 KB
2026-03-11 16:18:52
R W Run
253 By
2026-03-11 16:18:51
R W Run
7.96 KB
2026-03-11 16:18:52
R W Run
3.23 KB
2026-03-11 16:18:52
R W Run
969 By
2026-03-11 16:18:52
R W Run
16.28 KB
2026-03-11 16:18:51
R W Run
7.22 KB
2026-03-11 16:18:51
R W Run
12.95 KB
2026-03-11 16:18:51
R W Run
6.53 KB
2026-03-11 16:18:51
R W Run
3.42 KB
2026-03-11 16:18:52
R W Run
5.84 KB
2026-03-11 16:18:51
R W Run
1.97 KB
2026-03-11 16:18:51
R W Run
4.3 KB
2026-03-11 16:18:52
R W Run
2.91 KB
2026-03-11 16:18:51
R W Run
16.46 KB
2026-03-11 16:18:52
R W Run
40.6 KB
2026-03-11 16:18:51
R W Run
20.22 KB
2026-03-11 16:18:51
R W Run
36.11 KB
2026-03-11 16:18:52
R W Run
17.01 KB
2026-03-11 16:18:51
R W Run
7.27 KB
2026-03-11 16:18:52
R W Run
6.62 KB
2026-03-11 16:18:52
R W Run
16.49 KB
2026-03-11 16:18:52
R W Run
1.79 KB
2026-03-11 16:18:52
R W Run
29.82 KB
2026-03-11 16:18:51
R W Run
6.67 KB
2026-03-11 16:18:52
R W Run
8.98 KB
2026-03-11 16:18:52
R W Run
19.42 KB
2026-03-11 16:18:51
R W Run
12.01 KB
2026-03-11 16:18:51
R W Run
17.11 KB
2026-03-11 16:18:51
R W Run
6.74 KB
2026-03-11 16:18:52
R W Run
30.93 KB
2026-03-11 16:18:51
R W Run
4.99 KB
2026-03-11 16:18:51
R W Run
4.25 KB
2026-03-11 16:18:51
R W Run
24.72 KB
2026-03-11 16:18:51
R W Run
29.96 KB
2026-03-11 16:18:52
R W Run
6.41 KB
2026-03-11 16:18:51
R W Run
160 KB
2026-03-11 16:18:51
R W Run
6.72 KB
2026-03-11 16:18:52
R W Run
10.92 KB
2026-03-11 16:18:51
R W Run
4.77 KB
2026-03-11 16:18:51
R W Run
3.38 KB
2026-03-11 16:18:51
R W Run
11.18 KB
2026-03-11 16:18:51
R W Run
62.19 KB
2026-03-11 16:18:51
R W Run
2.46 KB
2026-03-11 16:18:51
R W Run
9.17 KB
2026-03-11 16:18:51
R W Run
32.15 KB
2026-03-11 16:18:51
R W Run
34.05 KB
2026-03-11 16:18:52
R W Run
7.15 KB
2026-03-11 16:18:51
R W Run
3.47 KB
2026-03-11 16:18:52
R W Run
1.87 KB
2026-03-11 16:18:52
R W Run
30.91 KB
2026-03-11 16:18:51
R W Run
7.29 KB
2026-03-11 16:18:52
R W Run
7.35 KB
2026-03-11 16:18:51
R W Run
12.54 KB
2026-03-11 16:18:51
R W Run
19.12 KB
2026-03-11 16:18:51
R W Run
18.12 KB
2026-03-11 16:18:52
R W Run
39.99 KB
2026-03-11 16:18:52
R W Run
5.17 KB
2026-03-11 16:18:52
R W Run
979 By
2026-03-11 16:18:51
R W Run
18.44 KB
2026-03-11 16:18:52
R W Run
10.24 KB
2026-03-11 16:18:51
R W Run
1.77 KB
2026-03-11 16:18:52
R W Run
34.9 KB
2026-03-11 16:18:51
R W Run
7.19 KB
2026-03-11 16:18:52
R W Run
160.5 KB
2026-03-11 16:18:51
R W Run
64.27 KB
2026-03-11 16:18:51
R W Run
27.95 KB
2026-03-11 16:18:51
R W Run
4.69 KB
2026-03-11 16:18:51
R W Run
2.94 KB
2026-03-11 16:18:51
R W Run
43.13 KB
2026-03-11 16:18:52
R W Run
2.25 KB
2026-03-11 16:18:52
R W Run
22.5 KB
2026-03-11 16:18:51
R W Run
13.01 KB
2026-03-11 16:18:52
R W Run
3.27 KB
2026-03-11 16:18:51
R W Run
18 KB
2026-03-11 16:18:51
R W Run
210.4 KB
2026-03-11 16:18:52
R W Run
25.86 KB
2026-03-11 16:18:52
R W Run
115.85 KB
2026-03-11 16:18:51
R W Run
373 By
2026-03-11 16:18:52
R W Run
343 By
2026-03-11 16:18:52
R W Run
338 By
2026-03-11 16:18:51
R W Run
100.73 KB
2026-03-11 16:18:52
R W Run
130.93 KB
2026-03-11 16:18:51
R W Run
19.1 KB
2026-03-11 16:18:51
R W Run
17.41 KB
2026-03-11 16:18:52
R W Run
41.98 KB
2026-03-11 16:18:52
R W Run
400 By
2026-03-11 16:18:52
R W Run
11.1 KB
2026-03-11 16:18:52
R W Run
37.02 KB
2026-03-11 16:18:51
R W Run
2.24 KB
2026-03-11 16:18:51
R W Run
188.13 KB
2026-03-11 16:18:51
R W Run
338 By
2026-03-11 16:18:51
R W Run
38 KB
2026-03-11 16:18:51
R W Run
4.02 KB
2026-03-11 16:18:52
R W Run
5.38 KB
2026-03-11 16:18:51
R W Run
3.05 KB
2026-03-11 16:18:52
R W Run
2.61 KB
2026-03-11 16:18:51
R W Run
1.16 KB
2026-03-11 16:18:52
R W Run
4.04 KB
2026-03-11 16:18:51
R W Run
3.71 KB
2026-03-11 16:18:51
R W Run
24.6 KB
2026-03-11 16:18:51
R W Run
9.56 KB
2026-03-11 16:18:51
R W Run
346.43 KB
2026-03-11 16:18:52
R W Run
281.84 KB
2026-03-11 16:18:52
R W Run
14.95 KB
2026-03-11 16:18:51
R W Run
8.44 KB
2026-03-11 16:18:52
R W Run
168.95 KB
2026-03-11 16:18:52
R W Run
20.71 KB
2026-03-11 16:18:52
R W Run
25.27 KB
2026-03-11 16:18:51
R W Run
5.72 KB
2026-03-11 16:18:51
R W Run
4.63 KB
2026-03-11 16:18:52
R W Run
81.73 KB
2026-03-11 16:18:51
R W Run
67.18 KB
2026-03-11 16:18:51
R W Run
156.36 KB
2026-03-11 16:18:52
R W Run
55.19 KB
2026-03-11 16:18:51
R W Run
162 By
2026-03-11 16:18:51
R W Run
61.72 KB
2026-03-11 16:18:51
R W Run
216.06 KB
2026-03-11 16:18:52
R W Run
65.09 KB
2026-03-11 16:18:51
R W Run
25.24 KB
2026-03-11 16:18:52
R W Run
4.81 KB
2026-03-11 16:18:51
R W Run
6.48 KB
2026-03-11 16:18:52
R W Run
21.25 KB
2026-03-11 16:18:51
R W Run
2.79 KB
2026-03-11 16:18:52
R W Run
89.69 KB
2026-03-11 16:18:52
R W Run
19.42 KB
2026-03-11 16:18:52
R W Run
3.69 KB
2026-03-11 16:18:52
R W Run
4.11 KB
2026-03-11 16:18:51
R W Run
40.74 KB
2026-03-11 16:18:51
R W Run
25.38 KB
2026-03-11 16:18:51
R W Run
43.31 KB
2026-03-11 16:18:52
R W Run
102.57 KB
2026-03-11 16:18:52
R W Run
6.18 KB
2026-03-11 16:18:51
R W Run
124.47 KB
2026-03-11 16:18:52
R W Run
35.65 KB
2026-03-11 16:18:52
R W Run
6.94 KB
2026-03-11 16:18:52
R W Run
67.04 KB
2026-03-11 16:18:52
R W Run
10.62 KB
2026-03-11 16:18:51
R W Run
289.35 KB
2026-03-11 16:18:52
R W Run
36.23 KB
2026-03-11 16:18:51
R W Run
200 By
2026-03-11 16:18:52
R W Run
200 By
2026-03-11 16:18:52
R W Run
98.29 KB
2026-03-11 16:18:52
R W Run
30.02 KB
2026-03-11 16:18:52
R W Run
19.03 KB
2026-03-11 16:18:52
R W Run
5.06 KB
2026-03-11 16:18:52
R W Run
255 By
2026-03-11 16:18:51
R W Run
22.66 KB
2026-03-11 16:18:52
R W Run
154.63 KB
2026-03-11 16:18:51
R W Run
9.68 KB
2026-03-11 16:18:51
R W Run
258 By
2026-03-11 16:18:51
R W Run
23.49 KB
2026-03-11 16:18:51
R W Run
3.16 KB
2026-03-11 16:18:51
R W Run
8.4 KB
2026-03-11 16:18:52
R W Run
441 By
2026-03-11 16:18:51
R W Run
7.39 KB
2026-03-11 16:18:51
R W Run
173 KB
2026-03-11 16:18:52
R W Run
544 By
2026-03-11 16:18:52
R W Run
4.17 KB
2026-03-11 16:18:51
R W Run
35.97 KB
2026-03-11 16:18:52
R W Run
1.69 KB
2026-03-11 16:18:51
R W Run
2.84 KB
2026-03-11 16:18:52
R W Run
6.09 KB
2026-03-11 16:18:51
R W Run
8.71 KB
2026-03-11 16:18:51
R W Run
131.84 KB
2026-03-11 16:18:51
R W Run
37.45 KB
2026-03-11 16:18:51
R W Run
173.89 KB
2026-03-11 16:18:51
R W Run
7.09 KB
2026-03-11 16:18:51
R W Run
6.41 KB
2026-03-11 16:18:51
R W Run
1.08 KB
2026-03-11 16:18:51
R W Run
69.46 KB
2026-03-11 16:18:52
R W Run
445 By
2026-03-11 16:18:51
R W Run
799 By
2026-03-11 16:18:52
R W Run
error_log
📄rewrite.php
1<?php
2/**
3 * WordPress Rewrite API
4 *
5 * @package WordPress
6 * @subpackage Rewrite
7 */
8
9/**
10 * Endpoint mask that matches nothing.
11 *
12 * @since 2.1.0
13 */
14define( 'EP_NONE', 0 );
15
16/**
17 * Endpoint mask that matches post permalinks.
18 *
19 * @since 2.1.0
20 */
21define( 'EP_PERMALINK', 1 );
22
23/**
24 * Endpoint mask that matches attachment permalinks.
25 *
26 * @since 2.1.0
27 */
28define( 'EP_ATTACHMENT', 2 );
29
30/**
31 * Endpoint mask that matches any date archives.
32 *
33 * @since 2.1.0
34 */
35define( 'EP_DATE', 4 );
36
37/**
38 * Endpoint mask that matches yearly archives.
39 *
40 * @since 2.1.0
41 */
42define( 'EP_YEAR', 8 );
43
44/**
45 * Endpoint mask that matches monthly archives.
46 *
47 * @since 2.1.0
48 */
49define( 'EP_MONTH', 16 );
50
51/**
52 * Endpoint mask that matches daily archives.
53 *
54 * @since 2.1.0
55 */
56define( 'EP_DAY', 32 );
57
58/**
59 * Endpoint mask that matches the site root.
60 *
61 * @since 2.1.0
62 */
63define( 'EP_ROOT', 64 );
64
65/**
66 * Endpoint mask that matches comment feeds.
67 *
68 * @since 2.1.0
69 */
70define( 'EP_COMMENTS', 128 );
71
72/**
73 * Endpoint mask that matches searches.
74 *
75 * Note that this only matches a search at a "pretty" URL such as
76 * `/search/my-search-term`, not `?s=my-search-term`.
77 *
78 * @since 2.1.0
79 */
80define( 'EP_SEARCH', 256 );
81
82/**
83 * Endpoint mask that matches category archives.
84 *
85 * @since 2.1.0
86 */
87define( 'EP_CATEGORIES', 512 );
88
89/**
90 * Endpoint mask that matches tag archives.
91 *
92 * @since 2.3.0
93 */
94define( 'EP_TAGS', 1024 );
95
96/**
97 * Endpoint mask that matches author archives.
98 *
99 * @since 2.1.0
100 */
101define( 'EP_AUTHORS', 2048 );
102
103/**
104 * Endpoint mask that matches pages.
105 *
106 * @since 2.1.0
107 */
108define( 'EP_PAGES', 4096 );
109
110/**
111 * Endpoint mask that matches all archive views.
112 *
113 * @since 3.7.0
114 */
115define( 'EP_ALL_ARCHIVES', EP_DATE | EP_YEAR | EP_MONTH | EP_DAY | EP_CATEGORIES | EP_TAGS | EP_AUTHORS );
116
117/**
118 * Endpoint mask that matches everything.
119 *
120 * @since 2.1.0
121 */
122define( 'EP_ALL', EP_PERMALINK | EP_ATTACHMENT | EP_ROOT | EP_COMMENTS | EP_SEARCH | EP_PAGES | EP_ALL_ARCHIVES );
123
124/**
125 * Adds a rewrite rule that transforms a URL structure to a set of query vars.
126 *
127 * Any value in the $after parameter that isn't 'bottom' will result in the rule
128 * being placed at the top of the rewrite rules.
129 *
130 * @since 2.1.0
131 * @since 4.4.0 Array support was added to the `$query` parameter.
132 *
133 * @global WP_Rewrite $wp_rewrite WordPress rewrite component.
134 *
135 * @param string $regex Regular expression to match request against.
136 * @param string|array $query The corresponding query vars for this rewrite rule.
137 * @param string $after Optional. Priority of the new rule. Accepts 'top'
138 * or 'bottom'. Default 'bottom'.
139 */
140function add_rewrite_rule( $regex, $query, $after = 'bottom' ) {
141 global $wp_rewrite;
142
143 $wp_rewrite->add_rule( $regex, $query, $after );
144}
145
146/**
147 * Adds a new rewrite tag (like %postname%).
148 *
149 * The `$query` parameter is optional. If it is omitted you must ensure that you call
150 * this on, or before, the {@see 'init'} hook. This is because `$query` defaults to
151 * `$tag=`, and for this to work a new query var has to be added.
152 *
153 * @since 2.1.0
154 *
155 * @global WP_Rewrite $wp_rewrite WordPress rewrite component.
156 * @global WP $wp Current WordPress environment instance.
157 *
158 * @param string $tag Name of the new rewrite tag.
159 * @param string $regex Regular expression to substitute the tag for in rewrite rules.
160 * @param string $query Optional. String to append to the rewritten query. Must end in '='. Default empty.
161 */
162function add_rewrite_tag( $tag, $regex, $query = '' ) {
163 // Validate the tag's name.
164 if ( strlen( $tag ) < 3 || '%' !== $tag[0] || '%' !== $tag[ strlen( $tag ) - 1 ] ) {
165 return;
166 }
167
168 global $wp_rewrite, $wp;
169
170 if ( empty( $query ) ) {
171 $qv = trim( $tag, '%' );
172 $wp->add_query_var( $qv );
173 $query = $qv . '=';
174 }
175
176 $wp_rewrite->add_rewrite_tag( $tag, $regex, $query );
177}
178
179/**
180 * Removes an existing rewrite tag (like %postname%).
181 *
182 * @since 4.5.0
183 *
184 * @global WP_Rewrite $wp_rewrite WordPress rewrite component.
185 *
186 * @param string $tag Name of the rewrite tag.
187 */
188function remove_rewrite_tag( $tag ) {
189 global $wp_rewrite;
190 $wp_rewrite->remove_rewrite_tag( $tag );
191}
192
193/**
194 * Adds a permalink structure.
195 *
196 * @since 3.0.0
197 *
198 * @see WP_Rewrite::add_permastruct()
199 * @global WP_Rewrite $wp_rewrite WordPress rewrite component.
200 *
201 * @param string $name Name for permalink structure.
202 * @param string $struct Permalink structure.
203 * @param array $args Optional. Arguments for building the rules from the permalink structure,
204 * see WP_Rewrite::add_permastruct() for full details. Default empty array.
205 */
206function add_permastruct( $name, $struct, $args = array() ) {
207 global $wp_rewrite;
208
209 // Back-compat for the old parameters: $with_front and $ep_mask.
210 if ( ! is_array( $args ) ) {
211 $args = array( 'with_front' => $args );
212 }
213
214 if ( func_num_args() === 4 ) {
215 $args['ep_mask'] = func_get_arg( 3 );
216 }
217
218 $wp_rewrite->add_permastruct( $name, $struct, $args );
219}
220
221/**
222 * Removes a permalink structure.
223 *
224 * Can only be used to remove permastructs that were added using add_permastruct().
225 * Built-in permastructs cannot be removed.
226 *
227 * @since 4.5.0
228 *
229 * @see WP_Rewrite::remove_permastruct()
230 * @global WP_Rewrite $wp_rewrite WordPress rewrite component.
231 *
232 * @param string $name Name for permalink structure.
233 */
234function remove_permastruct( $name ) {
235 global $wp_rewrite;
236
237 $wp_rewrite->remove_permastruct( $name );
238}
239
240/**
241 * Adds a new feed type like /atom1/.
242 *
243 * @since 2.1.0
244 *
245 * @global WP_Rewrite $wp_rewrite WordPress rewrite component.
246 *
247 * @param string $feedname Feed name. Should not start with '_'.
248 * @param callable $callback Callback to run on feed display.
249 * @return string Feed action name.
250 */
251function add_feed( $feedname, $callback ) {
252 global $wp_rewrite;
253
254 if ( ! in_array( $feedname, $wp_rewrite->feeds, true ) ) {
255 $wp_rewrite->feeds[] = $feedname;
256 }
257
258 $hook = 'do_feed_' . $feedname;
259
260 // Remove default function hook.
261 remove_action( $hook, $hook );
262
263 add_action( $hook, $callback, 10, 2 );
264
265 return $hook;
266}
267
268/**
269 * Removes rewrite rules and then recreate rewrite rules.
270 *
271 * @since 3.0.0
272 *
273 * @global WP_Rewrite $wp_rewrite WordPress rewrite component.
274 *
275 * @param bool $hard Whether to update .htaccess (hard flush) or just update
276 * rewrite_rules option (soft flush). Default is true (hard).
277 */
278function flush_rewrite_rules( $hard = true ) {
279 global $wp_rewrite;
280
281 if ( is_callable( array( $wp_rewrite, 'flush_rules' ) ) ) {
282 $wp_rewrite->flush_rules( $hard );
283 }
284}
285
286/**
287 * Adds an endpoint, like /trackback/.
288 *
289 * Adding an endpoint creates extra rewrite rules for each of the matching
290 * places specified by the provided bitmask. For example:
291 *
292 * add_rewrite_endpoint( 'json', EP_PERMALINK | EP_PAGES );
293 *
294 * will add a new rewrite rule ending with "json(/(.*))?/?$" for every permastruct
295 * that describes a permalink (post) or page. This is rewritten to "json=$match"
296 * where $match is the part of the URL matched by the endpoint regex (e.g. "foo" in
297 * "[permalink]/json/foo/").
298 *
299 * A new query var with the same name as the endpoint will also be created.
300 *
301 * When specifying $places ensure that you are using the EP_* constants (or a
302 * combination of them using the bitwise OR operator) as their values are not
303 * guaranteed to remain static (especially `EP_ALL`).
304 *
305 * Be sure to flush the rewrite rules - see flush_rewrite_rules() - when your plugin gets
306 * activated and deactivated.
307 *
308 * @since 2.1.0
309 * @since 4.3.0 Added support for skipping query var registration by passing `false` to `$query_var`.
310 *
311 * @global WP_Rewrite $wp_rewrite WordPress rewrite component.
312 *
313 * @param string $name Name of the endpoint.
314 * @param int $places Endpoint mask describing the places the endpoint should be added.
315 * Accepts a mask of:
316 * - `EP_ALL`
317 * - `EP_NONE`
318 * - `EP_ALL_ARCHIVES`
319 * - `EP_ATTACHMENT`
320 * - `EP_AUTHORS`
321 * - `EP_CATEGORIES`
322 * - `EP_COMMENTS`
323 * - `EP_DATE`
324 * - `EP_DAY`
325 * - `EP_MONTH`
326 * - `EP_PAGES`
327 * - `EP_PERMALINK`
328 * - `EP_ROOT`
329 * - `EP_SEARCH`
330 * - `EP_TAGS`
331 * - `EP_YEAR`
332 * @param string|bool $query_var Name of the corresponding query variable. Pass `false` to skip registering a query_var
333 * for this endpoint. Defaults to the value of `$name`.
334 */
335function add_rewrite_endpoint( $name, $places, $query_var = true ) {
336 global $wp_rewrite;
337 $wp_rewrite->add_endpoint( $name, $places, $query_var );
338}
339
340/**
341 * Filters the URL base for taxonomies.
342 *
343 * To remove any manually prepended /index.php/.
344 *
345 * @access private
346 * @since 2.6.0
347 *
348 * @param string $base The taxonomy base that we're going to filter
349 * @return string
350 */
351function _wp_filter_taxonomy_base( $base ) {
352 if ( ! empty( $base ) ) {
353 $base = preg_replace( '|^/index\.php/|', '', $base );
354 $base = trim( $base, '/' );
355 }
356 return $base;
357}
358
359
360/**
361 * Resolves numeric slugs that collide with date permalinks.
362 *
363 * Permalinks of posts with numeric slugs can sometimes look to WP_Query::parse_query()
364 * like a date archive, as when your permalink structure is `/%year%/%postname%/` and
365 * a post with post_name '05' has the URL `/2015/05/`.
366 *
367 * This function detects conflicts of this type and resolves them in favor of the
368 * post permalink.
369 *
370 * Note that, since 4.3.0, wp_unique_post_slug() prevents the creation of post slugs
371 * that would result in a date archive conflict. The resolution performed in this
372 * function is primarily for legacy content, as well as cases when the admin has changed
373 * the site's permalink structure in a way that introduces URL conflicts.
374 *
375 * @since 4.3.0
376 *
377 * @param array $query_vars Optional. Query variables for setting up the loop, as determined in
378 * WP::parse_request(). Default empty array.
379 * @return array Returns the original array of query vars, with date/post conflicts resolved.
380 */
381function wp_resolve_numeric_slug_conflicts( $query_vars = array() ) {
382 if ( ! isset( $query_vars['year'] ) && ! isset( $query_vars['monthnum'] ) && ! isset( $query_vars['day'] ) ) {
383 return $query_vars;
384 }
385
386 // Identify the 'postname' position in the permastruct array.
387 $permastructs = array_values( array_filter( explode( '/', get_option( 'permalink_structure' ) ) ) );
388 $postname_index = array_search( '%postname%', $permastructs, true );
389
390 if ( false === $postname_index ) {
391 return $query_vars;
392 }
393
394 /*
395 * A numeric slug could be confused with a year, month, or day, depending on position. To account for
396 * the possibility of post pagination (eg 2015/2 for the second page of a post called '2015'), our
397 * `is_*` checks are generous: check for year-slug clashes when `is_year` *or* `is_month`, and check
398 * for month-slug clashes when `is_month` *or* `is_day`.
399 */
400 $compare = '';
401 if ( 0 === $postname_index && ( isset( $query_vars['year'] ) || isset( $query_vars['monthnum'] ) ) ) {
402 $compare = 'year';
403 } elseif ( $postname_index && '%year%' === $permastructs[ $postname_index - 1 ] && ( isset( $query_vars['monthnum'] ) || isset( $query_vars['day'] ) ) ) {
404 $compare = 'monthnum';
405 } elseif ( $postname_index && '%monthnum%' === $permastructs[ $postname_index - 1 ] && isset( $query_vars['day'] ) ) {
406 $compare = 'day';
407 }
408
409 if ( ! $compare ) {
410 return $query_vars;
411 }
412
413 // This is the potentially clashing slug.
414 $value = '';
415 if ( array_key_exists( $compare, $query_vars ) ) {
416 $value = $query_vars[ $compare ];
417 }
418
419 $post = get_page_by_path( $value, OBJECT, 'post' );
420 if ( ! ( $post instanceof WP_Post ) ) {
421 return $query_vars;
422 }
423
424 // If the date of the post doesn't match the date specified in the URL, resolve to the date archive.
425 if ( preg_match( '/^([0-9]{4})\-([0-9]{2})/', $post->post_date, $matches ) && isset( $query_vars['year'] ) && ( 'monthnum' === $compare || 'day' === $compare ) ) {
426 // $matches[1] is the year the post was published.
427 if ( (int) $query_vars['year'] !== (int) $matches[1] ) {
428 return $query_vars;
429 }
430
431 // $matches[2] is the month the post was published.
432 if ( 'day' === $compare && isset( $query_vars['monthnum'] ) && (int) $query_vars['monthnum'] !== (int) $matches[2] ) {
433 return $query_vars;
434 }
435 }
436
437 /*
438 * If the located post contains nextpage pagination, then the URL chunk following postname may be
439 * intended as the page number. Verify that it's a valid page before resolving to it.
440 */
441 $maybe_page = '';
442 if ( 'year' === $compare && isset( $query_vars['monthnum'] ) ) {
443 $maybe_page = $query_vars['monthnum'];
444 } elseif ( 'monthnum' === $compare && isset( $query_vars['day'] ) ) {
445 $maybe_page = $query_vars['day'];
446 }
447 // Bug found in #11694 - 'page' was returning '/4'.
448 $maybe_page = (int) trim( $maybe_page, '/' );
449
450 $post_page_count = substr_count( $post->post_content, '<!--nextpage-->' ) + 1;
451
452 // If the post doesn't have multiple pages, but a 'page' candidate is found, resolve to the date archive.
453 if ( 1 === $post_page_count && $maybe_page ) {
454 return $query_vars;
455 }
456
457 // If the post has multiple pages and the 'page' number isn't valid, resolve to the date archive.
458 if ( $post_page_count > 1 && $maybe_page > $post_page_count ) {
459 return $query_vars;
460 }
461
462 // If we've gotten to this point, we have a slug/date clash. First, adjust for nextpage.
463 $query_vars['page'] = $maybe_page;
464
465 // Next, unset autodetected date-related query vars.
466 unset( $query_vars['year'] );
467 unset( $query_vars['monthnum'] );
468 unset( $query_vars['day'] );
469
470 // Then, set the identified post.
471 $query_vars['name'] = $post->post_name;
472
473 // Finally, return the modified query vars.
474 return $query_vars;
475}
476
477/**
478 * Examines a URL and try to determine the post ID it represents.
479 *
480 * Checks are supposedly from the hosted site blog.
481 *
482 * @since 1.0.0
483 *
484 * @global WP_Rewrite $wp_rewrite WordPress rewrite component.
485 * @global WP $wp Current WordPress environment instance.
486 *
487 * @param string $url Permalink to check.
488 * @return int Post ID, or 0 on failure.
489 */
490function url_to_postid( $url ) {
491 global $wp_rewrite;
492
493 /**
494 * Filters the URL to derive the post ID from.
495 *
496 * @since 2.2.0
497 *
498 * @param string $url The URL to derive the post ID from.
499 */
500 $url = apply_filters( 'url_to_postid', $url );
501
502 $url_host = parse_url( $url, PHP_URL_HOST );
503
504 if ( is_string( $url_host ) ) {
505 $url_host = str_replace( 'www.', '', $url_host );
506 } else {
507 $url_host = '';
508 }
509
510 $home_url_host = parse_url( home_url(), PHP_URL_HOST );
511
512 if ( is_string( $home_url_host ) ) {
513 $home_url_host = str_replace( 'www.', '', $home_url_host );
514 } else {
515 $home_url_host = '';
516 }
517
518 // Bail early if the URL does not belong to this site.
519 if ( $url_host && $url_host !== $home_url_host ) {
520 return 0;
521 }
522
523 // First, check to see if there is a 'p=N' or 'page_id=N' to match against.
524 if ( preg_match( '#[?&](p|page_id|attachment_id)=(\d+)#', $url, $values ) ) {
525 $id = absint( $values[2] );
526 if ( $id ) {
527 return $id;
528 }
529 }
530
531 // Get rid of the #anchor.
532 $url_split = explode( '#', $url );
533 $url = $url_split[0];
534
535 // Get rid of URL ?query=string.
536 $url_split = explode( '?', $url );
537 $url = $url_split[0];
538
539 // Set the correct URL scheme.
540 $scheme = parse_url( home_url(), PHP_URL_SCHEME );
541 $url = set_url_scheme( $url, $scheme );
542
543 // Add 'www.' if it is absent and should be there.
544 if ( str_contains( home_url(), '://www.' ) && ! str_contains( $url, '://www.' ) ) {
545 $url = str_replace( '://', '://www.', $url );
546 }
547
548 // Strip 'www.' if it is present and shouldn't be.
549 if ( ! str_contains( home_url(), '://www.' ) ) {
550 $url = str_replace( '://www.', '://', $url );
551 }
552
553 if ( trim( $url, '/' ) === home_url() && 'page' === get_option( 'show_on_front' ) ) {
554 $page_on_front = get_option( 'page_on_front' );
555
556 if ( $page_on_front && get_post( $page_on_front ) instanceof WP_Post ) {
557 return (int) $page_on_front;
558 }
559 }
560
561 // Check to see if we are using rewrite rules.
562 $rewrite = $wp_rewrite->wp_rewrite_rules();
563
564 // Not using rewrite rules, and 'p=N' and 'page_id=N' methods failed, so we're out of options.
565 if ( empty( $rewrite ) ) {
566 return 0;
567 }
568
569 // Strip 'index.php/' if we're not using path info permalinks.
570 if ( ! $wp_rewrite->using_index_permalinks() ) {
571 $url = str_replace( $wp_rewrite->index . '/', '', $url );
572 }
573
574 if ( str_contains( trailingslashit( $url ), home_url( '/' ) ) ) {
575 // Chop off http://domain.com/[path].
576 $url = str_replace( home_url(), '', $url );
577 } else {
578 // Chop off /path/to/blog.
579 $home_path = parse_url( home_url( '/' ) );
580 $home_path = isset( $home_path['path'] ) ? $home_path['path'] : '';
581 $url = preg_replace( sprintf( '#^%s#', preg_quote( $home_path ) ), '', trailingslashit( $url ) );
582 }
583
584 // Trim leading and lagging slashes.
585 $url = trim( $url, '/' );
586
587 $request = $url;
588 $post_type_query_vars = array();
589
590 foreach ( get_post_types( array(), 'objects' ) as $post_type => $t ) {
591 if ( ! empty( $t->query_var ) ) {
592 $post_type_query_vars[ $t->query_var ] = $post_type;
593 }
594 }
595
596 // Look for matches.
597 $request_match = $request;
598 foreach ( (array) $rewrite as $match => $query ) {
599
600 /*
601 * If the requesting file is the anchor of the match,
602 * prepend it to the path info.
603 */
604 if ( ! empty( $url ) && ( $url !== $request ) && str_starts_with( $match, $url ) ) {
605 $request_match = $url . '/' . $request;
606 }
607
608 if ( preg_match( "#^$match#", $request_match, $matches ) ) {
609
610 if ( $wp_rewrite->use_verbose_page_rules && preg_match( '/pagename=\$matches\[([0-9]+)\]/', $query, $varmatch ) ) {
611 // This is a verbose page match, let's check to be sure about it.
612 $page = get_page_by_path( $matches[ $varmatch[1] ] );
613 if ( ! $page ) {
614 continue;
615 }
616
617 $post_status_obj = get_post_status_object( $page->post_status );
618 if ( ! $post_status_obj->public && ! $post_status_obj->protected
619 && ! $post_status_obj->private && $post_status_obj->exclude_from_search ) {
620 continue;
621 }
622 }
623
624 /*
625 * Got a match.
626 * Trim the query of everything up to the '?'.
627 */
628 $query = preg_replace( '!^.+\?!', '', $query );
629
630 // Substitute the substring matches into the query.
631 $query = addslashes( WP_MatchesMapRegex::apply( $query, $matches ) );
632
633 // Filter out non-public query vars.
634 global $wp;
635 parse_str( $query, $query_vars );
636 $query = array();
637 foreach ( (array) $query_vars as $key => $value ) {
638 if ( in_array( (string) $key, $wp->public_query_vars, true ) ) {
639 $query[ $key ] = $value;
640 if ( isset( $post_type_query_vars[ $key ] ) ) {
641 $query['post_type'] = $post_type_query_vars[ $key ];
642 $query['name'] = $value;
643 }
644 }
645 }
646
647 // Resolve conflicts between posts with numeric slugs and date archive queries.
648 $query = wp_resolve_numeric_slug_conflicts( $query );
649
650 // Do the query.
651 $query = new WP_Query( $query );
652 if ( ! empty( $query->posts ) && $query->is_singular ) {
653 return $query->post->ID;
654 } else {
655 return 0;
656 }
657 }
658 }
659 return 0;
660}
661
Ui Ux Design – Teachers Night Out

Get in Touch

© 2024 Teachers Night Out. All Rights Reserved.