[wp-trac] [WordPress Trac] #13258: wp_dropdown_categories() uses $term->id instead of $term->name for taxonomies that are not categories

WordPress Trac noreply at wordpress.org
Sun May 17 01:50:32 UTC 2015


#13258: wp_dropdown_categories() uses $term->id instead of $term->name for
taxonomies that are not categories
-------------------------------------+------------------------
 Reporter:  mfields                  |       Owner:
     Type:  enhancement              |      Status:  closed
 Priority:  normal                   |   Milestone:
Component:  Taxonomy                 |     Version:  3.0
 Severity:  normal                   |  Resolution:  duplicate
 Keywords:  has-patch needs-refresh  |     Focuses:
-------------------------------------+------------------------
Changes (by boonebgorges):

 * status:  new => closed
 * resolution:   => duplicate
 * milestone:  Future Release =>


Comment:

 Whoops, this was fixed with the introduction of the 'value_field'
 parameter in [31006] #30306. You can use 'value_field' to specific id,
 slug, or whatever other term field you want to serve as the "value"
 attribute of the dropdown options.

 As for the precise issue that led to the opening of this ticket: The job
 of the category/term dropdown is to generate a dropdown. It does that
 perfectly fine. It so happens that, in the case of categories, the value
 of the dropdown can be used to concatenate a certain kind of URL
 (`?cat=13`), while the precise same thing can't be done in the case of
 other taxonomies. But this is not a bug. It just means that devs should be
 responsible for sanitizing data they get from form submits before
 generating URLs or any other user-facing data.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/13258#comment:21>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list