widget_types_to_hide_from_legacy_widget_block
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.
Использование
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.
Список изменений
С версии 5.8.0 | Введена. |
Где вызывается хук
widget_types_to_hide_from_legacy_widget_block
wp-includes/block-editor.php 258-278
$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', ) );