Add_query_arg + two times the same argument?

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 !

Leave a Comment