is_registered_sidebar

Checks if a sidebar is registered.

Description

is_registered_sidebar( (string|int) $sidebar_id ); 

Parameters (1)

0. $sidebar_id (string|int)
The ID of the sidebar when it was registered.

Usage

  1. if ( !function_exists( 'is_registered_sidebar' ) ) { 
  2. require_once ABSPATH . WPINC . '/widgets.php'; 
  3.  
  4. // The ID of the sidebar when it was registered. 
  5. $sidebar_id = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = is_registered_sidebar($sidebar_id); 
  9.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/widgets.php  
  1. function is_registered_sidebar( $sidebar_id ) { 
  2. global $wp_registered_sidebars; 
  3.  
  4. return isset( $wp_registered_sidebars[ $sidebar_id ] );