Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#50347 closed enhancement (fixed)

is_active_sidebar() documentation is terrible

Reported by: sum1's profile SUM1 Owned by: sergeybiryukov's profile 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 5 years ago.

Download all attachments as: .zip

Change History (4)

@SUM1
5 years ago

#1 @johnbillion
5 years 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
5 years 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
5 years 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.