WordPress.org

Make WordPress Core

Opened 6 months ago

Closed 6 months ago

Last modified 6 months ago

#50347 closed enhancement (fixed)

is_active_sidebar() documentation is terrible

Reported by: SUM1 Owned by: SergeyBiryukov
Milestone: 5.5 Priority: normal
Severity: normal Version:
Component: Widgets Keywords: has-patch
Focuses: docs Cc:

Description

The DocBlock for is_active_sidebar() in wp-includes/widgets.php is terrible, and I spent several hours wondering why mine returned true constantly, even when the sidebar wasn't loaded on the page.

Updated the documentation accordingly, to specify that it returns true if the sidebar contains widgets.

Attachments (1)

50347.patch (959 bytes) - added by SUM1 6 months ago.

Download all attachments as: .zip

Change History (4)

@SUM1
6 months ago

#1 @johnbillion
6 months ago

  • Component changed from General to Widgets
  • Keywords has-patch added
  • Milestone changed from Awaiting Review to 5.5
  • Version trunk deleted

Thanks @SUM1 !

#2 @SergeyBiryukov
6 months ago

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

In 47935:

Docs: Improve documentation for is_active_sidebar().

The function determines whether the sidebar contains widgets, not that it is loaded on the page.

Props SUM1.
Fixes #50347.

#3 @Hareesh Pillai
6 months ago

The developer handbook needs to be updated too.

https://developer.wordpress.org/themes/basics/conditional-tags/#is-sidebar-active

Presently, it reads

Check to see if a given sidebar is active (in use).
Returns true if the sidebar (identified by name, id, or number) is in use,
otherwise the function returns false.
Note: See TracTickets for help on using tickets.