[wp-trac] [WordPress Trac] #29118: Registering rewrite rules is hard, so let's introduce remove_rewrite_rule.
WordPress Trac
noreply at wordpress.org
Sun Nov 30 20:11:44 UTC 2014
#29118: Registering rewrite rules is hard, so let's introduce remove_rewrite_rule.
---------------------------+------------------------------
Reporter: ericlewis | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Rewrite Rules | Version:
Severity: normal | Resolution:
Keywords: has-patch | Focuses:
---------------------------+------------------------------
Comment (by MikeSchinkel):
Is there any appetite for re-imagining the URL rewrite process, one that
would be forward incompatible but backward compatible, i.e. that old
rewrites would still work?
The current system has limitations in that URLs must be context free, i.e.
that a URL pattern can mostly only be used for one type of rewrite. What
that means, for example, is that only slugs for `post_type='page'` can
route from the first URL path segment, i.e. we can't ever have this:
{{{
example.com/about/ <-- A page
example.com/mikeschinkel/ <-- an author
example.com/atlanta/ <-- an location post type
}}}
Thanks to the addition of the `'do_parse_request'` hook and an insight
gained from Otto we've been able to implement complex routing in our
client's web applications, and it works brilliantly. And if we are given
a URL path we don't need to route it just falls back to WordPress' default
URL rewrites.
Otto's insight is that you can segment the URLs by number of path segments
and then only need to test for patterns that match the path segments of
the incoming UR: path which significantly reduces the number regular
expressions needed to test for a match, except for pages of course. Add
to that the ability to cache common URL slugs, such as categories, and we
could eliminate most of the time spent looping and evaluating the 100+
rewrite Regexes on ever page load.
It would be great if we could see an new URL Routing API introduced to
WordPress core, phased in over a period of numerous releases. Is there
any stomach for considering this?
--
Ticket URL: <https://core.trac.wordpress.org/ticket/29118#comment:12>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list