With add_query_arg()
it is nice to add additional parameters to an URL and it is also easy to create a rewrite rule. So far so good. But the problem is the URL replacement done by wordpress.
When I have an URL, like:
www.mysite.com/?page_id=1&myvar=test
and I type this URL into the address line of the browser with activated permalinks. This link will become to:
www.example.com/pagename/?myvar=test
BUT: what I would like to get is:
www.example.com/pagename/test
Finally, I would like to use code like:
<a href="https://wordpress.stackexchange.com/questions/127141/<?php add_query_arg("myvar', 'test', get_permalink() ) ?>"> .... </a>
which would result in:
www.example.com/pagename/test
How can this be achieved? I have spent hours in reading documents and I couldn’t found a solution.