Opened 21 years ago
Closed 20 years ago
#1194 closed defect (bug) (fixed)
dropdown_cats doesn't add the correct selected tag
| Reported by: | crahan | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | 2.1 |
| Component: | General | Version: | 2.1 |
| Severity: | minor | Keywords: | has-patch 2nd-opinion |
| Cc: | Focuses: |
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
@
20 years ago
- Resolution fixed
- Status closed → 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
@
20 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
@
20 years ago
- Keywords has-patch 2nd-opinion added
- Milestone → 2.1
- Version 1.5 → 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()
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Ticket unclear as to where this occurs. I know of no place where this is broken in 2.1. Assuming fixed.