Make WordPress Core

Opened 5 weeks ago

Last modified 4 weeks ago

#62681 new defect (bug)

The theme count in Customizer > Change > WordPress.org Themes displays incorrect results

Reported by: ankitkumarshah's profile ankitkumarshah Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Customize Keywords: needs-patch has-testing-info needs-testing
Focuses: Cc:

Description

When navigating to Customize > Change > WordPress.org Themes, selecting filters for theme search and then deselecting the filters immediately results in an incorrect theme count being displayed.

Steps to Reproduce:

  1. Go to Appearance > Customize > Change > WordPress.org Themes.
  1. Apply any filter to search for themes (e.g., Accessibility Ready, Block Editor Patterns, Block Editor Styles, etc).
  1. Deselect the applied filters instantly.
  1. Notice that the theme count displayed is incorrect.

https://i.postimg.cc/J7vXVFzD/image.png

Video:
https://utfs.io/f/TnWMEUzoUd855CZXZgBsSwYB9kjRr72FlZL3UcDuaPMOHhCG

Attachments (1)

62681.patch (1.3 KB) - added by parthvataliya 4 weeks ago.
This patch resolves the issue.

Download all attachments as: .zip

Change History (9)

#1 @usmandev000
5 weeks ago

This issue may be related to caching or a delayed refresh of the theme count. As a temporary workaround:

  1. After deselecting the filters, try refreshing the page to reset the theme count.
  2. Alternatively, navigate back to the previous section and return to the theme selector to force the count to update.

#2 follow-up: @usmandev000
5 weeks ago

Sometimes, incorrect functionality in the WordPress Customizer can be caused by plugin or theme conflicts. To rule out this possibility:

  1. Deactivate all plugins and switch to a default theme like Twenty Twenty-Three.
  2. Test the theme filter behavior again. If the issue persists, it’s likely a core WordPress bug. If the behavior changes, reactivate plugins one by one to identify the conflicting component.

#3 in reply to: ↑ 2 @usmandev000
5 weeks ago

Replying to usmandev000:

Sometimes, incorrect functionality in the WordPress Customizer can be caused by plugin or theme conflicts. To rule out this possibility:

  1. Deactivate all plugins and switch to a default theme like Twenty Twenty-Three.
  2. Test the theme filter behavior again. If the issue persists, it’s likely a core WordPress bug. If the behavior changes, reactivate plugins one by one to identify the conflicting component.

@ankitkumarshah try this, if the issue still persists, please let me know.

#4 @sainathpoojary
5 weeks ago

  • Keywords needs-patch has-testing-info added

Hey @ankitkumarshah,

I was able to reproduce the issue. Additionally, I tried the suggestions provided by @usmandev000, but the problem still persists. I also investigated further to identify the root cause and found that the issue is related to this section of the code but I wasn't able to discover the root cause.

#5 @parthvataliya
5 weeks ago

Reproduction Report

Description

This report validates whether the issue can be reproduced.

Environment

  • WordPress: 6.8-alpha-59274-src
  • PHP: 8.2.26
  • Server: nginx/1.27.3
  • Database: mysqli (Server: 8.0.40 / Client: mysqlnd 8.2.26)
  • Browser: Chrome 131.0.0.0
  • OS: Linux
  • Theme: Twenty Twenty-One 2.4
  • MU Plugins: None activated
  • Plugins:
    • Test Reports 1.2.0

Actual Results

  1. ✅ Error condition occurs (reproduced).

Additional Notes

  • When we deselect an applied filter instantly, this issue is reproduced because there is a condition, such as section.loading being true, in the initializeNewQuery, filtersChecked, and loadThemes functions. This indicates whether the theme section is fully loaded or not.
  • To address this, we could consider adding a loader when a filter is selected or deselected. However, this might frustrate end-users by making them wait to deselect a filter or select another option. If anyone has suggestions on how to handle this scenario more efficiently, please share your ideas.
Last edited 4 weeks ago by parthvataliya (previous) (diff)

@parthvataliya
4 weeks ago

This patch resolves the issue.

#6 @parthvataliya
4 weeks ago

  • Keywords needs-testing added

#7 @lumiblog
4 weeks ago

Reproduction Report

Description

This report validates whether the issue can be reproduced.

Environment

  • WordPress: 6.7.1
  • PHP: 8.2.23
  • Server: nginx/1.26.1
  • Database: mysqli (Server: 8.0.16 / Client: mysqlnd 8.2.23)
  • Browser: Chrome 131.0.0.0
  • OS: Windows 10
  • Theme: Twenty Twenty-One 2.4
  • MU Plugins: None activated
  • Plugins:
    • Test Reports 1.2.0

Actual Results

  1. ✅ Error condition occurs (Reproduced).

Supplemental Artifacts

https://drive.google.com/file/d/1SCtSvqIMHL2OdJ5tz7wtzYlqsFpne13O/view

#8 @sainathpoojary
4 weeks ago

Hey @parthvataliya,

I’ve tested the patch for the reported issue, and it’s working well on my end. To provide further clarity, I’ve attached a demonstration video below showcasing the fix in action.

Video: https://utfs.io/f/PL8E4NiPUWyOoSlhSjgRVfkrM3cxj5whHLEvyNZCb2PpWuod

Note: See TracTickets for help on using tickets.