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 :)


  • There are a number of very similar questions. Look to the right under "Related".
    – s_ha_dum
    Feb 13, 2013 at 14:34

1 Answer 1


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.



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.