Opened 2 years ago
Last modified 2 years ago
#16677 reopened enhancement
wp_dropdown_categories() shows the wrong name/id when $taxonomy argument is set
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Future Release |
| Component: | Taxonomy | Version: | 3.1 |
| Severity: | normal | Keywords: | has-patch |
| Cc: | ramiy |
Description
when using wp_dropdown_categories() the code result is:
<select name='cat' id='cat' class='postform' > <option class="level-0" value="1">item 1</option> <option class="level-0" value="2">item 2</option> <option class="level-0" value="3">item 3</option> </select>
The name='cat' id='cat'.
When using wp_dropdown_categories( array( 'taxonomy' => 'channel' ) ) the code result is:
<select name='cat' id='cat' class='postform' > <option class="level-0" value="1">term item 1</option> <option class="level-0" value="2">term item 2</option> <option class="level-0" value="3">term item 3</option> </select>
The name and the id did not changed to channel.
Attachments (2)
Change History (7)
comment:2
follow-up:
↓ 3
ocean90
— 2 years ago
- Keywords needs-patch removed
- Milestone Awaiting Review deleted
- Resolution set to invalid
- Status changed from new to closed
It's expected behaviour. cat is the default value.
If you want your own name and id you must use this:
wp_dropdown_categories( array( 'taxonomy' => 'channel', 'name' => 'channel' ) )
(id will be the same as name if id isn't set.)
comment:3
in reply to:
↑ 2
ramiy
— 2 years ago
- Cc ramiy added
- Keywords needs-patch added
- Resolution invalid deleted
- Status changed from closed to reopened
- Summary changed from wp_dropdown_categories() shows the wrong name/id when $taxonomy arg is present to wp_dropdown_categories() shows the wrong name/id when $taxonomy argument is set
ocean90, Thank you for the quick response.
The "Expected behaviour" is not always the "Right behaviour".
I know that i can change the "name" and the even the "class" arguments. But i think this should be done automaticly by the system/function.
When i use the category taxonomy, i expect to see name='cat' id='cat'. And when i use custom taxomony, i expect it to be name='term' id='term'.
Furthermore, when using taxonomy=cat we don't need to set name=cat, its done automaticly. The same behaviour shold be in custom taxomony.
When $taxonomy argument is set (and $name is not) the name shold be equal to taxonomy.
The problem is in wp-includes/category-template.php line 337-342.