Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

thanks

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
add comment

1 Answer

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.

see:

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

Your Answer

 
discard

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.