I've added a myvar/myvalue
rewrite endpoint to EP_ALL
which can be added to any URL of a WP installation and a WP plugin will act upon it. That part is cool but it doesn't work when the permalink structure is /%category%/%postname%/
. It works well with all the built in, selectable structures. There could be other structures it doesn't work with.
Doesn't work = 404 error.
The path looks something like this: /mycategory/mypost/myvar/myvalue
I got the Rewrite analyzer plugin which tells me that it's interpreted as (top 4, in order):
This is not it... (highlighted with yellow)
(.?.+?)/myvar(/(.*))?/?$
pagename: mycategory/mypost
myvar: myvalue
Apparently this gets used but it's still cold...
.?.+?/([^/]+)/myvar(/(.*))?/?$
attachment: mypost
myvar: /myvalue
Plain wrong...
(.?.+?)(/[0-9]+)?/?$
pagename: mycategory/mypost/myvar
page: /myvalue
This is it, but it fails to realize it!
(.+?)/([^/]+)/myvar(/(.*))?/?$
category_name: mycategory
name: mypost
myvar: myvalue
And I'm outputting global $query_string;
which tells me it's
attachment=mypost&myvar=%2Fmyvalue
(by the way it shouldn't include the %2f - slash).
So can someone enlighten me if this is a bug in WP, or is there something I can do about it?
My idea is roughly this
if ( '/%category%/%postname%/' == $wp_rewrite->permalink_structure ){ ... }
and manually telling WP the category and the name and displaying that content. But I don't know what goes as ...
and what should I hook this into.