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.
<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" />
</form>

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

1 Answer 1

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

 
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.