0

I'am trying to filter my archive page by clicking links. When clicked they execute the add_query_arg command.

Everything works fine so far.

But now i want to add combinations within the same custom taxonomy.

ex: http://url.com/archive/ '?events=test&events=test2'

now the question, how to add two times the same argument with add_query_arg without overwriting the first one ? And how to get them again ?

Hope someone can help me out here.

Best regards

  • You can pass two values as comma separated in a single parameter events. And later parse value correctly in your page. – Nilambar Aug 13 '14 at 8:24
  • that sounds good ! i'm going to try that. Thanks !!! – AnC Aug 13 '14 at 8:39
0

Nilambar's comment solved this for me.

"You can pass two values as comma separated in a single parameter events. And later parse value correctly in your page. – Nilambar"

I use this to get posts with tag1 OR tag2:

echo '<a href="'.esc_attr(add_query_arg( 'events', 'tag1,tag2')).'">Linkname</a>';

And to get all posts with tag1 AND tag2 simply use "+" instead of ",":

echo '<a href="'.esc_attr(add_query_arg( 'events', 'tag1+tag2')).'">Linkname</a>';

Thanks Nilambar !

  • Glad that I could be of some help :-) – Nilambar Aug 13 '14 at 12:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.