is_block_editor() || 'appearance_page_gutenberg-widgets' === $screen->id || ( function_exists( 'gutenberg_is_edit_site_page' ) && gutenberg_is_edit_site_page( $screen->id ) ) ); } /** * Whether or not to use the block editor to manage widgets. Defaults to true * unless a theme has removed support for widgets-block-editor or a plugin has * filtered the return value of this function. * * @return boolean Whether or not to use the block editor to manage widgets. */ function gutenberg_use_widgets_block_editor() { /** * Filters whether or not to use the block editor to manage widgets. * * @param boolean $use_widgets_block_editor Whether or not to use the block editor to manage widgets. */ return apply_filters( 'gutenberg_use_widgets_block_editor', get_theme_support( 'widgets-block-editor' ) ); } /** * Returns the settings required by legacy widgets blocks. * * @return array Legacy widget settings. */ function gutenberg_get_legacy_widget_settings() { $settings = array(); $widget_types_to_hide_from_legacy_widget_block = apply_filters( 'widget_types_to_hide_from_legacy_widget_block', array( 'pages', 'calendar', 'archives', 'media_audio', 'media_image', 'media_gallery', 'media_video', 'search', 'text', 'categories', 'recent-posts', 'recent-comments', 'rss', 'tag_cloud', 'custom_html', 'block', ) ); $settings['widgetTypesToHideFromLegacyWidgetBlock'] = $widget_types_to_hide_from_legacy_widget_block; return $settings; } /** * Overrides dynamic_sidebar_params to make sure Blocks are not wrapped in
'; } return $arg; } /** * Registers the WP_Widget_Block widget. */ function gutenberg_register_block_widget() { global $pagenow; register_widget( 'WP_Widget_Block' ); // By default every widget on widgets.php is wrapped with a