WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'd like my search forms to only display results organized by tag.

I know you can add &tag=TAGNAME to the end of a search results URL, but how do I integrate it into a form so that my site only searches for posts containing tags equal to whatever was entered in the search box?

I have two searches on the page, so ideally I'd like to be able to add it via HTML into the forms themselves as opposed to anywhere else, but any answer is fine :)


share|improve this question
There are a number of very similar questions. Look to the right under "Related". – s_ha_dum Feb 13 '13 at 14:34

You can hook inside the result, so that you change the query and search about the tags. The result is than a loop with all posts to this tag.

You can relized this inside the template, there are is the output for search or write a small plugin, that hook inside the query and change the query, if it your search; perhaps with your url param. For the plugin use the hook pre_get_posts.


share|improve this answer
Great stuff, thank you :) – Kyle Feb 13 '13 at 14:15

Your Answer


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

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