Opened 20 years ago
Closed 19 years ago
#1194 closed defect (bug) (fixed)
dropdown_cats doesn't add the correct selected tag
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | 2.1 | Priority: | normal |
Severity: | minor | Version: | 2.1 |
Component: | General | Keywords: | has-patch 2nd-opinion |
Focuses: | Cc: |
Description
The dropdown_cats parameter to mark the current category as selected in the dropdownlist doesn't work. It can be fixed by changing:
if ($category->cat_ID == $selected)
echo ' selected="selected"';
echo '>';
to
if (is_category($category->cat_ID) && $selected)
echo ' selected="selected"';
echo '>';
Attachments (1)
Change History (8)
#3
@
19 years ago
- Resolution fixed deleted
- Status changed from closed to reopened
I verified. If you use it on a category page, it doesn't select the currently-viewed category.
In the fix, definitely reverse the order of the checks.
if ( $selected && is_category($category->cat_ID) )
Don't want to do all those is_category() calls if we don't have to!
I'll crank out a patch here in a minute.
#4
@
19 years ago
Also, see if we can use wp_dropdown_categories() in place of some of the dropdown_cats calls in the admin. I get tired of maintaining both of them.
#5
@
19 years ago
- Keywords has-patch 2nd-opinion added
- Milestone set to 2.1
- Version changed from 1.5 to 2.1
Codex say that for the deprecated dropdown_cats() function, "selected" was the ID of the category to be selected, but it should default to the current category. I think we should mimic this behavior in wp_dropdown_categories().
The problem here is that the default is zero, rather than the current category.
Patch sets default to the current category, for is_category() views, 0 otherwise.
#3088 opened for conversion from dropdown_cats() to wp_dropdown_categories()
Ticket unclear as to where this occurs. I know of no place where this is broken in 2.1. Assuming fixed.