wp_get_sidebar() – Retrieves the registered sidebar with the given ID.

You appear to be a bot. Output may be restricted

Description

Retrieves the registered sidebar with the given ID.

Usage

$array|null = wp_get_sidebar( $id );

Parameters

$id
( string ) required – The sidebar ID.

Returns

array|null The discovered sidebar, or null if it is not registered.

Source

File name: wordpress/wp-includes/widgets.php


Lines:

1 to 19 of 19
function wp_get_sidebar( $id ) {
  global $wp_registered_sidebars;

  foreach ( (array) $wp_registered_sidebars as $sidebar ) {
    if ( $sidebar['id'] === $id ) {
      return $sidebar;
    }
  }

  if ( 'wp_inactive_widgets' === $id ) {
    return array(
      'id'   => 'wp_inactive_widgets',
      'name' => __( 'Inactive widgets' ),
    );
  }

  return null;
}
 

 View on GitHub View on Trac