equal
deleted
inserted
replaced
142 |
142 |
143 $wp_rewrite->add_rule( $regex, $query, $after ); |
143 $wp_rewrite->add_rule( $regex, $query, $after ); |
144 } |
144 } |
145 |
145 |
146 /** |
146 /** |
147 * Add a new rewrite tag (like %postname%). |
147 * Adds a new rewrite tag (like %postname%). |
148 * |
148 * |
149 * The `$query` parameter is optional. If it is omitted you must ensure that you call |
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 |
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. |
151 * `$tag=`, and for this to work a new query var has to be added. |
152 * |
152 * |
189 global $wp_rewrite; |
189 global $wp_rewrite; |
190 $wp_rewrite->remove_rewrite_tag( $tag ); |
190 $wp_rewrite->remove_rewrite_tag( $tag ); |
191 } |
191 } |
192 |
192 |
193 /** |
193 /** |
194 * Add permalink structure. |
194 * Adds a permalink structure. |
195 * |
195 * |
196 * @since 3.0.0 |
196 * @since 3.0.0 |
197 * |
197 * |
198 * @see WP_Rewrite::add_permastruct() |
198 * @see WP_Rewrite::add_permastruct() |
199 * @global WP_Rewrite $wp_rewrite WordPress rewrite component. |
199 * @global WP_Rewrite $wp_rewrite WordPress rewrite component. |
235 |
235 |
236 $wp_rewrite->remove_permastruct( $name ); |
236 $wp_rewrite->remove_permastruct( $name ); |
237 } |
237 } |
238 |
238 |
239 /** |
239 /** |
240 * Add a new feed type like /atom1/. |
240 * Adds a new feed type like /atom1/. |
241 * |
241 * |
242 * @since 2.1.0 |
242 * @since 2.1.0 |
243 * |
243 * |
244 * @global WP_Rewrite $wp_rewrite WordPress rewrite component. |
244 * @global WP_Rewrite $wp_rewrite WordPress rewrite component. |
245 * |
245 * |
263 |
263 |
264 return $hook; |
264 return $hook; |
265 } |
265 } |
266 |
266 |
267 /** |
267 /** |
268 * Remove rewrite rules and then recreate rewrite rules. |
268 * Removes rewrite rules and then recreate rewrite rules. |
269 * |
269 * |
270 * @since 3.0.0 |
270 * @since 3.0.0 |
271 * |
271 * |
272 * @global WP_Rewrite $wp_rewrite WordPress rewrite component. |
272 * @global WP_Rewrite $wp_rewrite WordPress rewrite component. |
273 * |
273 * |
281 $wp_rewrite->flush_rules( $hard ); |
281 $wp_rewrite->flush_rules( $hard ); |
282 } |
282 } |
283 } |
283 } |
284 |
284 |
285 /** |
285 /** |
286 * Add an endpoint, like /trackback/. |
286 * Adds an endpoint, like /trackback/. |
287 * |
287 * |
288 * Adding an endpoint creates extra rewrite rules for each of the matching |
288 * Adding an endpoint creates extra rewrite rules for each of the matching |
289 * places specified by the provided bitmask. For example: |
289 * places specified by the provided bitmask. For example: |
290 * |
290 * |
291 * add_rewrite_endpoint( 'json', EP_PERMALINK | EP_PAGES ); |
291 * add_rewrite_endpoint( 'json', EP_PERMALINK | EP_PAGES ); |
355 return $base; |
355 return $base; |
356 } |
356 } |
357 |
357 |
358 |
358 |
359 /** |
359 /** |
360 * Resolve numeric slugs that collide with date permalinks. |
360 * Resolves numeric slugs that collide with date permalinks. |
361 * |
361 * |
362 * Permalinks of posts with numeric slugs can sometimes look to WP_Query::parse_query() |
362 * Permalinks of posts with numeric slugs can sometimes look to WP_Query::parse_query() |
363 * like a date archive, as when your permalink structure is `/%year%/%postname%/` and |
363 * like a date archive, as when your permalink structure is `/%year%/%postname%/` and |
364 * a post with post_name '05' has the URL `/2015/05/`. |
364 * a post with post_name '05' has the URL `/2015/05/`. |
365 * |
365 * |
471 // Finally, return the modified query vars. |
471 // Finally, return the modified query vars. |
472 return $query_vars; |
472 return $query_vars; |
473 } |
473 } |
474 |
474 |
475 /** |
475 /** |
476 * Examine a URL and try to determine the post ID it represents. |
476 * Examines a URL and try to determine the post ID it represents. |
477 * |
477 * |
478 * Checks are supposedly from the hosted site blog. |
478 * Checks are supposedly from the hosted site blog. |
479 * |
479 * |
480 * @since 1.0.0 |
480 * @since 1.0.0 |
481 * |
481 * |