I'm trying to edit a wordpress theme.

The following is the section of code where the list of categories is retrieved and displayed in a drop-down menu.

<label for="entrycat">* <?php _e( "Question category:", "sofa_qanda" ); ?></label>
$select = wp_dropdown_categories( 'show_option_none=Select&show_count=0&orderby=name&echo=0&hide_empty=0' );
$select = preg_replace( '|<select(.*?).*?>|i', '<select id="entrycat" name="entrycat" tabindex="4">', $select );
echo $select;

I what to exclude a particular category, say category id 10 from the list. How do I do that?



use the 'exclude' parameter; example:

$select = wp_dropdown_categories( 'show_option_none=Select&show_count=0&orderby=name&echo=0&hide_empty=0&exclude=10' ); 

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.