[wp-trac] [WordPress Trac] #22619: add_rewrite_endpoint generates incorrect attachment rules
WordPress Trac
noreply at wordpress.org
Wed Nov 28 08:47:43 UTC 2012
#22619: add_rewrite_endpoint generates incorrect attachment rules
-----------------------------+---------------------------
Reporter: batmoo | Type: defect (bug)
Status: new | Priority: normal
Milestone: Awaiting Review | Component: Rewrite Rules
Version: | Severity: normal
Keywords: |
-----------------------------+---------------------------
{{{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}}}.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/22619>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list