I'd like to add multiple query varquery_var / value pairs to any URL. For example the base URL of a page is:
example.com/nice-page/
I can already achieve one endpoint like (for example, an on-page subgallery):
example.com/nice-page/my-gallery/animals/cats
Where my-gallery
is the query_var and animals/cats
is its value. Using this:
add_rewrite_endpoint('my-gallery', EP_PAGES);
add_rewrite_endpoint('my-lightbox', EP_PAGES);
I also need this to work:
example.com/nice-page/my-gallery/animals/cats/my-lightbox/1234
Where I'd like to register my-lightbox
as an additional endpoint or query_var, because it could be used independently from without my-gallery
, such as:
example.com/another-page/my-lightbox/2345
Currently I get the entire animals/cats/my-lightbox/1234
as the value. I can't make WP aware that a new query_var starts at my-lightbox
when my-gallery
is alrady present. It seems that rewrite tags are acting on the entirety of the input URL, and endpoints are acting on the end of the input URL, but the regex $ end-anchor is always there. Is it even possible to use the rewrite api to prettify multiple query_vars into a complex URL?