Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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:


and I type this URL into the address line of the browser with activated permalinks. This link will become to:


BUT: what I would like to get is:


Finally, I would like to use code like:

<a href="<?php add_query_arg( 'myvar', 'test', get_permalink() ) ?>"> .... </a>

which would result in:


How can this be achieved? I have spent hours in reading documents and I couldn't found a solution.

share|improve this question
I'd like to know how this is done. +1 to the question. –  henrywright Dec 27 '13 at 21:04
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.