Why is wp_dropdown_categories adding two select dropdowns?
-
Hi guys, ??
I’ve been using this code in the “Dropdown without a Submit Button using JavaScript (2)” section of that page:
<?php $select = wp_dropdown_categories('show_option_none=Select category&show_count=1&orderby=name&echo=0'); $select = preg_replace("#<select([^>]*)>#", "<select$1 onchange='return this.form.submit()'>", $select); echo $select; ?>
I’ve used it in a few of my wordpress installations and every time it outputs two select fields with the categories inside. But only the second one has the required form onsubmit code: onchange=’return this.form.submit()’
Does anyone know why it’s adding two category drop downs for me and is there any way I can stop it other than using some hacky CSS first-child display none? ??
Thanks!
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Why is wp_dropdown_categories adding two select dropdowns?’ is closed to new replies.