Depth parameter not working in wp_dropdown_categories
-
I’m pretty new to editing php parameters, but I’m trying to get wp_dropdown_categories to work with my search form. All I need it to do is exclude a few categories, and also only display top-level categories. The exclude parameter is working but depth isn’t. Can anyone help me troubleshoot? Here’s my searchform code:
<form method=”get” id=”searchform” action=”<?php bloginfo(‘url’); ?>/”>
<label class=”hidden” for=”s”><?php _e(‘Search for:’); ?></label>
<div><input type=”text” value=”<?php the_search_query(); ?>” name=”s” id=”s” />
<?php wp_dropdown_categories(‘exclude=1,42,147,174&depth=1’); ?>
<input type=”submit” id=”searchsubmit” value=”Search” />
</div>
</form>And here’s my search page:
https://ronsdalepress.com/searchThe only categories that should be appearing are ‘All Books’ and ‘Authors’, as they’re the only non-excluded top-level categories. Instead, all the non-excluded categories, including child categories, are displaying. Any ideas?
- The topic ‘Depth parameter not working in wp_dropdown_categories’ is closed to new replies.