#47609 closed defect (bug) (invalid)
Archive widget has stopped working.
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | 5.2.2 |
| Component: | Widgets | Keywords: | |
| Focuses: | Cc: |
Description
When I choose a month nothing happens.
In previous versions of WordPress, <select> form was filled with the onchange property:
<select id="archives-dropdown-2" name="archive-dropdown" onchange="document.location.href=this.options[this.selectedIndex].value;">
This worked perfectly.
Now JavaScript function is being used, which seems to work incorrect in my WordPress installation:
<script type="text/javascript">
/* <![CDATA[ */
(function() {
var dropdown = document.getElementById( "archives-dropdown-3" );
function onSelectChange() {
if ( dropdown.options[ dropdown.selectedIndex ].value !== '' ) {
document.location.href = this.options[ this.selectedIndex ].value;
}
}
dropdown.onchange = onSelectChange;
})();
/* ]]> */
</script>
Most likely this bug was introduced in this commit: https://github.com/WordPress/WordPress/commit/bba488f2b7fc241b03063fefc58a1db479e977d6#diff-f1b15459db03501d704506f19d778693R107
P.S. I use these settings:
Attachments (1)
Change History (5)
#2
@
6 years ago
- Keywords reporter-feedback added
Hi @EXL, welcome to WordPress Trac! Thanks for the report.
Looks like there is a mismatch between archives-dropdown-2 in the older code and archives-dropdown-3 in the newer function, however I could not reproduce the issue on a clean install.
After creating two Archives widgets on the same page (getting archives-dropdown-2 and archives-dropdown-3 ID attributes, respectively), choosing a month in either of them work as expected for me. Tested with the latest stable versions of Google Chrome and Microsoft Edge.
- Which browser are you using?
- Could you provide the steps to reproduce the issue on a clean install?
- Do you have a live page example where the widget doesn't work as expected?
- Does the similar JS code in the Categories widget work for you?

WordPress Archive Widget Settings