Codex tools: Log in / create account
Possible API for WP_Rewrite to make it easier for plugins to interact with it.
Contents |
A function for adding a straight rewrite rule.
Parameters:
The URL should look like 'index.php?var1=$matches[1]&var2=$matches[2]&var3=$matches[3]' where var1-3 are the relevant query variables and $matches refers to matches in the regular expression.
What it needs to do:
Add a new tag (like %postname%):
Parameters:
What it needs to do:
Notes: I was thinking about passing a callback to this function which would be called with the contents of the QV when a request matched the regex (so e.g. if the regex is ([0-9]{3}) as in skippy's case, we could accept a callback to call when someone requests a Julian date, say, /2006/32, passing 32), but I don't think this will be flexible enough: people might want to hook onto parse_request, or pre_get_posts, or parse_query, or many other hooks. So we can just do the $wp_rewrite->add_rewrite_tag() bit and leave it up to the query author to add their own hooks.
Add a new endpoint like /trackback/
Parameters:
This adds the endpoint to all link types indicated (e.g. posts, pages, category, author, search) and then template-loader.php includes the relevent handler file
The name of the endpoint is added as query variable and this gets as value any text present after the endpoint name, separated from the name with a '/'. The template_redirect handler should test this query variable.
This could be used for all sorts of things:
--Westi 22:08, 5 Feb 2006 (GMT)
Add a new feed type like /atom1/
Parameters:
This simply adds/overrides the feed type and then wp-feed.php includes the relavent handler file
--Westi 22:06, 5 Feb 2006 (GMT)
Add a new base permalink type (equivalent of author, archives, category etc. or equivalent of search)
Parameters:
This simply adds a new permalink base type. Either with or without the standard permalink appendage. It could be used for a /tags/tagname type structure, or to embedded a gallery or for something like /wibble/2005/12/3 where you wanted to put a particular spin on the query results
--Westi 22:06, 5 Feb 2006 (GMT)
To do something similar to what skippy was asking for, you'd do this: