WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 10 months ago

Last modified 10 months ago

#24878 closed enhancement (fixed)

is_registered_sidebar()

Reported by: GaryJ Owned by: wonderboymusic
Milestone: 4.4 Priority: normal
Severity: normal Version:
Component: Widgets Keywords: has-patch
Focuses: Cc:

Description

is_active_sidebar() looks at whether a sidebar has any widgets in it, but there doesn't seem to be a function that purely checks to see if a sidebar is still registered within the $wp_registered_sidebars global, irrespective of whether it would have any widgets in it or not.

Attachments (2)

24878.diff (897 bytes) - added by GaryJ 3 years ago.
Adds is_registered_sidebar() to compliment register_sidebar() and unregister_sidebar().
24878.2.diff (3.7 KB) - added by wonderboymusic 10 months ago.

Download all attachments as: .zip

Change History (7)

@GaryJ
3 years ago

Adds is_registered_sidebar() to compliment register_sidebar() and unregister_sidebar().

#3 @wonderboymusic
10 months ago

  • Milestone changed from Awaiting Review to 4.4

#4 @wonderboymusic
10 months ago

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

In 35102:

Widgets: add a function, is_registered_sidebar() - helps us avoid touching the $wp_registered_sidebars global.

Props GaryJ, wonderboymusic.
Fixes #24878.

#5 @DrewAPicture
10 months ago

In 35104:

Widgets: Rename the $name parameter in is_registered_sidebar() to $sidebar_id and adjust the accepted types to string|int as sidebar IDs can be numeric.

See #24878.

Note: See TracTickets for help on using tickets.