[wp-trac] [WordPress Trac] #13258: wp_dropdown_categories() uses $term->id instead of $term->name for taxonomies that are not categories
WordPress Trac
wp-trac at lists.automattic.com
Fri May 7 02:20:45 UTC 2010
#13258: wp_dropdown_categories() uses $term->id instead of $term->name for
taxonomies that are not categories
--------------------------+-------------------------------------------------
Reporter: mfields | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 3.0
Component: Taxonomy | Version: 3.0
Severity: normal | Keywords: wp_dropdown_categories, tag, taxonomy, category
--------------------------+-------------------------------------------------
Comment(by mfields):
Replying to [comment:1 nacin]:
> wp_dropdown_categories() only returns HTML. I imagine you're referring
to the default widget in particular?
I actually just finished up a plugin [http://wordpress.mfields.org/2010
/screenshot-of-the-new-taxonomy-widget-plugin/] that is a fork of the
categories widget. It would have been simple to create except for the bug
in wp_dropdown_categories(). To fix the bug, I had to rewrite
functionality of wp_dropdown_categories(), walk_category_dropdown_tree()
and the Walker_CategoryDropdown class.
The reported bug is in the html outputed by the Walker_CategoryDropdown
class mainly this line:
{{{
$output .= "\t<option class=\"level-$depth\"
value=\"".$category->term_id."\"";
}}}
Which works great for categories by does not work at all for other
taxonomies.
/?cat=14
/?tag=my-tag-name
/?taxonomy=my-taxonomy-term-name
Categories are the only ''post taxonomy'' queried by id number, all others
use slug. I reported this as a bug because I was looking through core and
saw that wp_dropdown_categories() now allows the user to pass ''taxonomy''
as a key in the $args array.
This would be awesome to have fixed in core. Hopefully I have explained
the issues well enough. You can see the changes that I needed to make to
get my plugin functioning correctly here
[http://wordpress.pastebin.com/scckuBhp].
Thanks for your attention!
--
Ticket URL: <http://core.trac.wordpress.org/ticket/13258#comment:2>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list