#22619 closed defect (bug) (fixed)
add_rewrite_endpoint generates incorrect attachment rules
Reported by: | batmoo | Owned by: | duck_ |
---|---|---|---|
Milestone: | 3.7 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Rewrite Rules | Keywords: | has-patch 3.7-early |
Focuses: | Cc: |
Description
add_rewrite_endpoint
with EP_ALL
or EP_ATTACHMENT
results in incorrect endpoint matches. The index set for the endpoint value is 2
which ends up returning the slash as well. The index should actually be 3
since we only care about the inner match.
Example:
add_rewrite_endpoint( 'my-endpoint', EP_ALL )
Results in rules like (dump from $wp_rewrite->generate_rules
:
'.?.+?/([^/]+)/my-endpoint(/(.*))?/?$' => string(35) "index.php?attachment=$1&my-endpoint=$2" '.?.+?/attachment/([^/]+)/my-endpoint(/(.*))?/?$' => string(35) "index.php?attachment=$1&my-endpoint=$2"
Visiting a my-endpoint
URL for an attachment like /2012/01/01/post-name/attachment/my-endpoint/foo/
will return the value of get_query_var( 'my-endpoint' )
as /foo
instead of foo
.
Attachments (1)
Change History (8)
Note: See
TracTickets for help on using
tickets.
In 24809: