block_categories_all

過濾鉤子
apply_filters( 'block_categories_all', $block_categories, $block_editor_context )
引數
  • (array[]) $block_categories Array of categories for block types.
    Required:
  • (WP_Block_Editor_Context) $block_editor_context The current block editor context.
    Required:
定義位置
相關勾子
block_editor_settings_allwidget_categories_argsload-categories-phplink_categoryallowed_block_types_all
相關方法
get_block_categorieslink_categories_meta_boxrender_block_core_categoriesget_default_block_categoriesget_categoriesregister_block_core_categories
引入
5.8.0
棄用
-

block_categories_all: 這是WordPress中的一個過濾鉤子,允許開發者修改塊編輯器中可用的塊類別列表。block_categories_all鉤子將預設的區塊類別列表作為一個引數傳遞,鉤子函式可以返回一個修改後的區塊類別列表來代替使用。這對於新增自定義塊類別或改變現有塊類別的外觀或行為非常有用。

過濾塊型別的預設類別陣列。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
$block_categories = apply_filters( 'block_categories_all', $block_categories, $block_editor_context );
$block_categories = apply_filters( 'block_categories_all', $block_categories, $block_editor_context );
$block_categories = apply_filters( 'block_categories_all', $block_categories, $block_editor_context );

常見問題

FAQs
檢視更多 >