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 have a grand-parent-category with several parent-category. Each groundchild means a specific method to process later. Parents should not be selected, it merely means to group the children together.

I use wp_dropdown_categories with child_of to show the dropdown form. The parents shows up as a choice which can course confusing for users.

wp_dropdown_categories('child_of'=>$ground_parent_id);

If I add exclude = $parent_ids, the whole dropdown list gone.

wp_dropdown_categories('child_of'=>$groun_parent_id,'exclude'=>$parent_ids );

I can throw error message or process to a default value if a user choosed a parent, but this is a way to frustrat my users. Is there any other way to make a dropdown without parent?

share|improve this question

1 Answer 1

the easiest solution for you , providing you do not have 200 categories, is to use the exclude AND include parameters together . Alternatively , you can construct your own list with get_categories. or use the exclude_tree .

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.