[wp-trac] [WordPress Trac] #18877: DRY up rewrite rule matching
WordPress Trac
noreply at wordpress.org
Mon Jun 6 02:58:19 UTC 2016
#18877: DRY up rewrite rule matching
--------------------------------------+--------------------------
Reporter: scribu | Owner:
Type: enhancement | Status: assigned
Priority: normal | Milestone: 4.6
Component: Rewrite Rules | Version:
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests | Focuses: performance
--------------------------------------+--------------------------
Comment (by rmccue):
@ericlewis Looks good to me. I've been adapting my #36292 patch to
incorporate this. Couple of notes:
* We're calling `$wp_rewrite->wp_rewrite_rules()` twice, once in a check
in `WP::parse_request()` and once in the new
`WP_Rewrite::get_rewrite_rule_for_request()`. Probably a micro-
optimisation to remove that (since it stores in an option anyway), but if
we could avoid it, might be nice.
* With #36292 in mind, I've moved the query string parsing back to
`WP::parse_request`, as it sets other variables (such as the new
`$wp->perform_main_query`). This means returning the rule object *and* the
matches, which means we're now returning three items. Bit annoying.
I'll upload a patch that incorporates my #36292 changes as a POC (not for
commit), maybe there's a better way to solve the latter issue.
The patch itself looks great, +1 on commit if others are happy with it.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/18877#comment:23>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list