Used By
Used By | Description |
---|---|
wp-includes/class-wp-rewrite.php: WP_Rewrite::page_rewrite_rules() | Retrieves all of the rewrite rules for pages. |
wp-includes/rewrite.php: add_rewrite_tag() | Add a new rewrite tag (like %postname%). |
Adds or updates existing rewrite tags (e.g. %postname%).
If the tag already exists, replace the existing pattern and query for that tag, otherwise add the new tag.
(string) (Required) Name of the rewrite tag to add or update.
(string) (Required) Regular expression to substitute the tag for in rewrite rules.
(string) (Required) String to append to the rewritten query. Must end in '='.
Add an element to the $rewritecode, $rewritereplace and $queryreplace arrays using each parameter respectively. If $tag already exists in $rewritecode, the existing value will be overwritten.
See also: add_rewrite_tag($tagname, $regex)
File: wp-includes/class-wp-rewrite.php
public function add_rewrite_tag( $tag, $regex, $query ) { $position = array_search( $tag, $this->rewritecode, true ); if ( false !== $position && null !== $position ) { $this->rewritereplace[ $position ] = $regex; $this->queryreplace[ $position ] = $query; } else { $this->rewritecode[] = $tag; $this->rewritereplace[] = $regex; $this->queryreplace[] = $query; } }
Version | Description |
---|---|
1.5.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_rewrite/add_rewrite_tag