Make WordPress Core

Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#47609 closed defect (bug) (invalid)

Archive widget has stopped working.

Reported by: EXL Owned by:
Milestone: Priority: normal
Severity: normal Version: 5.2.2
Component: Widgets Keywords:
Focuses: Cc:


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;
/* ]]> */

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)

WordPress_Archive_Widget_Settings.png (10.0 KB) - added by EXL 2 years ago.
WordPress Archive Widget Settings

Download all attachments as: .zip

Change History (5)

2 years ago

WordPress Archive Widget Settings

#2 @SergeyBiryukov
2 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.

  1. Which browser are you using?
  2. Could you provide the steps to reproduce the issue on a clean install?
  3. Do you have a live page example where the widget doesn't work as expected?
Version 0, edited 2 years ago by SergeyBiryukov (next)

#3 @EXL
2 years ago

  • Resolution set to invalid
  • Status changed from new to closed

I'm sorry. The error was found in my own template.

#4 @SergeyBiryukov
2 years ago

  • Keywords reporter-feedback removed
  • Milestone Awaiting Review deleted

No worries, thanks for the follow-up.

Note: See TracTickets for help on using tickets.