[ Index ] |
PHP Cross Reference of WordPress |
[Source view] [Print] [Project Stats]
WordPress Rewrite API
File Size: | 641 lines (19 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
add_rewrite_rule( $regex, $query, $after = 'bottom' ) X-Ref |
Adds a rewrite rule that transforms a URL structure to a set of query vars. Any value in the $after parameter that isn't 'bottom' will result in the rule being placed at the top of the rewrite rules. since: 2.1.0 since: 4.4.0 Array support was added to the `$query` parameter. param: string $regex Regular expression to match request against. param: string|array $query The corresponding query vars for this rewrite rule. param: string $after Optional. Priority of the new rule. Accepts 'top' |
add_rewrite_tag( $tag, $regex, $query = '' ) X-Ref |
Adds a new rewrite tag (like %postname%). The `$query` parameter is optional. If it is omitted you must ensure that you call this on, or before, the {@see 'init'} hook. This is because `$query` defaults to `$tag=`, and for this to work a new query var has to be added. since: 2.1.0 param: string $tag Name of the new rewrite tag. param: string $regex Regular expression to substitute the tag for in rewrite rules. param: string $query Optional. String to append to the rewritten query. Must end in '='. Default empty. |
remove_rewrite_tag( $tag ) X-Ref |
Removes an existing rewrite tag (like %postname%). since: 4.5.0 param: string $tag Name of the rewrite tag. |
add_permastruct( $name, $struct, $args = array() X-Ref |
Adds a permalink structure. since: 3.0.0 param: string $name Name for permalink structure. param: string $struct Permalink structure. param: array $args Optional. Arguments for building the rules from the permalink structure, |
remove_permastruct( $name ) X-Ref |
Removes a permalink structure. Can only be used to remove permastructs that were added using add_permastruct(). Built-in permastructs cannot be removed. since: 4.5.0 param: string $name Name for permalink structure. |
add_feed( $feedname, $function ) X-Ref |
Adds a new feed type like /atom1/. since: 2.1.0 return: string Feed action name. param: string $feedname Feed name. param: callable $function Callback to run on feed display. |
flush_rewrite_rules( $hard = true ) X-Ref |
Removes rewrite rules and then recreate rewrite rules. since: 3.0.0 param: bool $hard Whether to update .htaccess (hard flush) or just update |
add_rewrite_endpoint( $name, $places, $query_var = true ) X-Ref |
Adds an endpoint, like /trackback/. Adding an endpoint creates extra rewrite rules for each of the matching places specified by the provided bitmask. For example: add_rewrite_endpoint( 'json', EP_PERMALINK | EP_PAGES ); will add a new rewrite rule ending with "json(/(.*))?/?$" for every permastruct that describes a permalink (post) or page. This is rewritten to "json=$match" where $match is the part of the URL matched by the endpoint regex (e.g. "foo" in "[permalink]/json/foo/"). A new query var with the same name as the endpoint will also be created. When specifying $places ensure that you are using the EP_* constants (or a combination of them using the bitwise OR operator) as their values are not guaranteed to remain static (especially `EP_ALL`). Be sure to flush the rewrite rules - see flush_rewrite_rules() - when your plugin gets activated and deactivated. since: 2.1.0 since: 4.3.0 Added support for skipping query var registration by passing `false` to `$query_var`. param: string $name Name of the endpoint. param: int $places Endpoint mask describing the places the endpoint should be added. param: string|bool $query_var Name of the corresponding query variable. Pass `false` to skip registering a query_var |
_wp_filter_taxonomy_base( $base ) X-Ref |
Filters the URL base for taxonomies. To remove any manually prepended /index.php/. since: 2.6.0 return: string param: string $base The taxonomy base that we're going to filter |
wp_resolve_numeric_slug_conflicts( $query_vars = array() X-Ref |
Resolves numeric slugs that collide with date permalinks. Permalinks of posts with numeric slugs can sometimes look to WP_Query::parse_query() like a date archive, as when your permalink structure is `/%year%/%postname%/` and a post with post_name '05' has the URL `/2015/05/`. This function detects conflicts of this type and resolves them in favor of the post permalink. Note that, since 4.3.0, wp_unique_post_slug() prevents the creation of post slugs that would result in a date archive conflict. The resolution performed in this function is primarily for legacy content, as well as cases when the admin has changed the site's permalink structure in a way that introduces URL conflicts. since: 4.3.0 return: array Returns the original array of query vars, with date/post conflicts resolved. param: array $query_vars Optional. Query variables for setting up the loop, as determined in |
url_to_postid( $url ) X-Ref |
Examines a URL and try to determine the post ID it represents. Checks are supposedly from the hosted site blog. since: 1.0.0 return: int Post ID, or 0 on failure. param: string $url Permalink to check. |
Generated: Wed Oct 9 01:00:02 2024 | Cross-referenced by PHPXref 0.7.1 |