﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	severity	resolution	keywords	cc
22619	add_rewrite_endpoint generates incorrect attachment rules	batmoo		"{{{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}}}."	defect (bug)	new	normal	Awaiting Review	Rewrite Rules		normal			batmoo info@… knut@… LucasMS
