apply_filters( ‘widget_types_to_hide_from_legacy_widget_block’, string[] $widgets )

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

Description

Returning an empty array will make all widgets available.

Parameters

$widgetsstring[]
An array of excluded widget-type IDs.

Source

$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',
	)
);

Changelog

VersionDescription
5.8.0Introduced.

User Contributed Notes

  1. Skip to note 2 content

    In version 5.8, the following widgets are hidden from the 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',
    		)

    To make all of them visible, the following code can be used:

    add_filter( 'widget_types_to_hide_from_legacy_widget_block','__return_empty_array' );

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