# gutenberg/16.2.0/lib/compat/wordpress-6.2/widgets.php

Gutenberg, version 16.2.0. 36 lines.

- Page: https://pluginprobe.com/plugins/gutenberg/16.2.0/code/lib/compat/wordpress-6.2/widgets.php
- Raw: https://pluginprobe.com/plugins/gutenberg/16.2.0/raw/lib/compat/wordpress-6.2/widgets.php
- Modified: 2023-02-22T17:19:42+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/gutenberg/16.2.0/code/lib/compat/wordpress-6.2/widgets.php#L10-L20`.

```php
<?php
/**
 * Core Widget APIs for WP 6.2.
 *
 * @package gutenberg
 */

if ( ! function_exists( '_wp_block_theme_register_classic_sidebars' ) ) {
	/**
	 * Registers the previous theme's sidebars for the block themes.
	 *
	 * @since 6.2.0
	 * @access private
	 *
	 * @global array $wp_registered_sidebars Registered sidebars.
	 */
	function _wp_block_theme_register_classic_sidebars() {
		global $wp_registered_sidebars;

		if ( ! wp_is_block_theme() ) {
			return;
		}

		$legacy_sidebars = get_theme_mod( 'wp_classic_sidebars' );
		if ( empty( $legacy_sidebars ) ) {
			return;
		}

		// Don't use `register_sidebar` since it will enable the `widgets` support for a theme.
		foreach ( $legacy_sidebars as $sidebar ) {
			$wp_registered_sidebars[ $sidebar['id'] ] = $sidebar;
		}
	}
	add_action( 'widgets_init', '_wp_block_theme_register_classic_sidebars' );
}

```
