2

I need to find only posts with a tag forest gump. I've tried: new WP_Query('tag=forest+gump');, new WP_Query('tag=forest gump');. However they both return ALL the posts and not only the posts with forest gump tag. Single tags (without spaces) work fine, though. Alternatives (like plain SQL) will work as well.

The entry tag line is forest gump, forrest gump, questend.

4
new WP_Query(array('tag_slug__in' => array('forrest-gump', 'forest-gump', 'questend')));

new WP_Query('tag=forrest+gump,forest+gump,questend'); should work too...

  • The + doesn't work, but the dashes work just fine. Thank you. Nevertheless, I didn't find this anywhere in the WP docs. – Gajus Jun 29 '11 at 12:25
  • @Guy WP_Query > Tag Parameters – Rarst Jun 29 '11 at 12:50
  • @Rast, yes, I saw that page. Mind pointing out the paragraph that provides this information? – Gajus Jun 29 '11 at 17:20
  • This displays every article of those tags when I query it.. – Maartje Mar 18 '14 at 16:09

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.