Multiple Tag Search WordPress

Wordpress 3.5.2. Old construction like

?tag=tag1+tag2

doesn't work any more. i dunno why. I have a form with check boxes. And tags which sorts by category. So i wanna search by

tag1+tag2+tag3

in specific category. How to do that? I'm tired look for a solution :(

Upvotes: 3

Views: 6933

Answers (1)

wunderdojo
wunderdojo

Reputation: 1027

Comma separate them:

/** posts with any of the following tags */   
$query = new WP_Query( 'tag=bread,baking' );

/** posts with all of the following tags */
$query = new WP_Query( 'tag=bread+baking+recipe' );

/** or alternatively */
$query = new WP_Query( array( 'tag_slug__in' => array( 'bread', 'baking' ) ) );

Documented here: http://codex.wordpress.org/Class_Reference/WP_Query

Upvotes: 1

Related Questions