Opened 3 years ago

Last modified 2 years ago

#14876 reopened defect (bug)

wp_get_sidebars_widgets() assumes that widgets are enabled

Reported by: nacin Owned by:
Priority: lowest Milestone: Future Release
Component: Widgets Version:
Severity: minor Keywords:
Cc:

Description

When a theme does not have any sidebars defined, wp_get_sidebars_widgets() will return the database option anyway.

This reveals a bug where a theme that does not have any widgets may still get the recent comments CSS injected into it. is_active_widget() is returning true because that widget was active when the sidebar option was last used.

Change History (5)

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

(In [15994]) Return empty array in wp_get_sidebars_widgets() if no sidebars are defined. fixes #14876.

  • Resolution fixed deleted
  • Status changed from closed to reopened

Turns out that is_active_widget() would be called before widgets_init, inside the default widget constructors. Thus, no sidebars would be registered, and we get false returned.

Reverting [15994] for now. This was noticed when trying to add a filter to #15493.

(In [16521]) Revert [15994] for now, as the default widgets then go through an identity crisis. see #14876, #15493.

(In [16522]) Add a simple filter to allow removing the recent comments default widget styles. fixes #15493, see #14876.

  • Milestone changed from 3.1 to Future Release

Maybe we just need a did_action() && ! doing_action() check in there.

Not a regression. Punting.

Note: See TracTickets for help on using tickets.