widget_types_to_hide_from_legacy_widget_block filter-hookWP 5.8.0

Filters the list of widget-type IDs that should not be offered by the Legacy Widget block.

Returning an empty array will make all widgets available.

Usage

add_filter( 'widget_types_to_hide_from_legacy_widget_block', 'wp_kama_widget_types_to_hide_from_legacy_block_filter' );

/**
 * Function for `widget_types_to_hide_from_legacy_widget_block` filter-hook.
 * 
 * @param string[] $widgets An array of excluded widget-type IDs.
 *
 * @return string[]
 */
function wp_kama_widget_types_to_hide_from_legacy_block_filter( $widgets ){

	// filter...
	return $widgets;
}
$widgets(string[])
An array of excluded widget-type IDs.

Changelog

Since 5.8.0 Introduced.

Where the hook is called

get_legacy_widget_block_editor_settings()
widget_types_to_hide_from_legacy_widget_block
wp-includes/block-editor.php 259-279
$editor_settings['widgetTypesToHideFromLegacyWidgetBlock'] = 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',
	)
);

Where the hook is used in WordPress

Usage not found.