[wp-trac] [WordPress Trac] #16677: wp_dropdown_categories() shows the wrong name/id when $taxonomy argument is set

WordPress Trac noreply at wordpress.org
Mon Sep 16 04:29:37 UTC 2013


#16677: wp_dropdown_categories() shows the wrong name/id when $taxonomy argument is
set
-------------------------+-----------------------------
 Reporter:  ramiy        |       Owner:
     Type:  enhancement  |      Status:  reopened
 Priority:  normal       |   Milestone:  Future Release
Component:  Taxonomy     |     Version:  3.1
 Severity:  normal       |  Resolution:
 Keywords:  has-patch    |
-------------------------+-----------------------------
Changes (by nacin):

 * milestone:  3.7 => Future Release


Comment:

 This seems wrong. The patch actually forcibly overrides 'name', when in
 reality, someone may have passed a desired 'name' in.

 What should happen instead is the *default* should change from 'cat' to
 whatever the taxonomy name is. Only, the reason why it it is 'cat' is
 because that is the name of the corresponding query variable. So what we
 actually need to do is default it to null, then figure out what taxonomy
 is being queried, and then if 'name' was not passed in, use that
 taxonomy's query variable as the default.

 Ah, but not quite. 'cat' is not the official query variable of categories.
 That'd be 'category_name'. I don't remember the difference, something
 having to do with inclusion of children I think. Either way, 'cat' is the
 ID, while 'category_name' is the actual slug (which is why it is the query
 variable). If you look at Walker_CategoryDropdown, term_id is clearly used
 for option values.

 I'm sure it's possible to untangle all of this and to come up with some
 sane defaults that actually make sense. It might need to involve a
 wp_dropdown_terms() — which is ideally an alias/wrapper at some point, but
 we've held onto the namespace for some time that way we can "pivot" here
 if necessary.

 So, for now, I don't think a change makes sense here.

--
Ticket URL: <http://core.trac.wordpress.org/ticket/16677#comment:7>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list