wp_get_sidebar( string $id ): array|null

Retrieves the registered sidebar with the given ID.


Parameters

$id string Required
The sidebar ID.

Top ↑

Return

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


Top ↑

Source

File: wp-includes/widgets.php. View all references

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


Top ↑

Changelog

Changelog
Version Description
5.9.0 Introduced.

Top ↑

User Contributed Notes

You must log in before being able to contribute a note or feedback.