wpseek.com
A WordPress-centric search engine for devs and theme authors



wp_get_sidebar › WordPress Function

Since5.9.0
Deprecatedn/a
wp_get_sidebar ( $id )
Parameters:
  • (string) $id The sidebar id.
    Required: Yes
Returns:
  • (array|null) The discovered sidebar, or null if it is not registered.
Defined at:
Codex:

Retrieves the registered sidebar with the given id.



Source

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;
}