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 want to make a search page, offering search functionalities by: 1) word 2) tag 3) category 4) author Can you recommend any technique, any guideline as per how to tackle this?

share|improve this question

2 Answers 2

up vote 2 down vote accepted

You'll want to add some radio buttons inside your search form. Then add a filter to your search:

function filter_search( $query ) {
if( $query->is_search ) {
            if ( isset($_GET['tag']) )
            // alter your search query here.
}
return $query;
}
add_filter( 'pre_get_posts' , 'filter_search' );

Influenced by http://wordpress.org/support/topic/how-to-add-search-filter-by-custom-values#post-1463329

share|improve this answer
    
I ll have that in mind in case I build the query string manually via radio-boxes and text-boxes. Thanks! –  p.a. Jul 20 '12 at 6:21

If you'd prefer to let a WordPress plugin handle the work for you, check out Search Everything, in the WordPress plugin repository.

Increases WordPress' default search functionality in three easy steps using Search Everything.

Better WordPress search in three steps

Activate Configure options Search ( maybe that's only two steps )

Options include search highlight, searching pages, excerpts, attachments, drafts, comments and custom fields (metadata).

What it does:

Search Everything increases the ability of the default WordPress Search, options included:

  • Search Highlighting
  • Search Every Page
  • Search Every Tag
  • Search Custom Taxonomies ( new )
  • Search Every Category
  • Search non-password protected pages only
  • Search Every Comment
  • Search only approved comments
  • Search Every Draft
  • Search Every Excerpt
  • Search Every Attachment (post type)
  • Search Every Custom Field (metadata)
  • Exclude Posts from search
  • Exclude Categories from search

[WordPress Plugin]: Search Everything

share|improve this answer
    
great idea, I ve tried it for custom post types search and it works, thanks! –  p.a. Jul 20 '12 at 6:20
    
This plugin is helpful but it does the opposite from what I need: it takes as input a word and searches tags, categories, titles etc for this word. What I need is criteria like: categoryZ & tag "XYY" & title contains "House". So I guess this plugin is not usable here. Correct? –  p.a. Jul 20 '12 at 7:29

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.