widget_types_to_hide_from_legacy_widget_block
Filter HookDescription
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.Hook Information
| File Location |
wp-includes/block-editor.php
View on GitHub
|
| Hook Type | Filter |
| Line Number | 260 |
Hook Parameters
| Type | Name | Description |
|---|---|---|
string[]
|
$widgets
|
An array of excluded widget-type IDs. |
Usage Examples
Basic Usage
<?php
// Hook into widget_types_to_hide_from_legacy_widget_block
add_filter('widget_types_to_hide_from_legacy_widget_block', 'my_custom_filter', 10, 1);
function my_custom_filter($widgets) {
// Your custom filtering logic here
return $widgets;
}
Source Code Context
wp-includes/block-editor.php:260
- How this hook is used in WordPress core
<?php
255 *
256 * @since 5.8.0
257 *
258 * @param string[] $widgets An array of excluded widget-type IDs.
259 */
260 $editor_settings['widgetTypesToHideFromLegacyWidgetBlock'] = apply_filters(
261 'widget_types_to_hide_from_legacy_widget_block',
262 array(
263 'pages',
264 'calendar',
265 'archives',
PHP Documentation
<?php
/**
* 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.
*
* @since 5.8.0
*
* @param string[] $widgets An array of excluded widget-type IDs.
*/
Quick Info
- Hook Type: Filter
- Parameters: 1
- File: wp-includes/block-editor.php
Related Hooks
Related hooks will be displayed here in future updates.