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
<form id="searchform" method="get" action="<?php echo home_url(); ?>">
<input type="text" name="s" id="s" size="15" />
<?php wp_dropdown_categories( 'show_option_none=Select' ); ?>
<input type="submit" value="Search" />

This snippet gives me a searchbox with a selectbox in which I can choose which category I want to search in. That's nice, but I don't want to show it ALL categories that I have, no, I want to show it specific categories.

How can I do this? Is that even possible?

share|improve this question
up vote 0 down vote accepted

A simple search in codex shows there are some parameters you can set to exclude some categories for example :

 <?php $args = array(
'show_option_all'    => '',
'show_option_none'   => '',
'orderby'            => 'ID', 
'order'              => 'ASC',
'show_count'         => 0,
'hide_empty'         => 1, 
'child_of'           => 0,
'exclude'            => '',
'echo'               => 1,
'selected'           => 0,
'hierarchical'       => 0, 
'name'               => 'cat',
'id'                 => '',
'class'              => 'postform',
'depth'              => 0,
'tab_index'          => 0,
'taxonomy'           => 'category',
'hide_if_empty'      => false
); ?>
share|improve this answer

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.