Filter hook 'block_categories_all'

in WP Core File wp-includes/block-editor.php at line 86

View Source

block_categories_all

Filter Hook
Description
Filters the default array of categories for block types.

Hook Information

File Location wp-includes/block-editor.php View on GitHub
Hook Type Filter
Line Number 86

Hook Parameters

Type Name Description
array[] $block_categories Array of categories for block types.
WP_Block_Editor_Context $block_editor_context The current block editor context.

Usage Examples

Basic Usage
<?php
// Hook into block_categories_all
add_filter('block_categories_all', 'my_custom_filter', 10, 2);

function my_custom_filter($block_categories, $block_editor_context) {
    // Your custom filtering logic here
    return $block_categories;
}

Source Code Context

wp-includes/block-editor.php:86 - How this hook is used in WordPress core
<?php
  81  	 * @since 5.8.0
  82  	 *
  83  	 * @param array[]                 $block_categories     Array of categories for block types.
  84  	 * @param WP_Block_Editor_Context $block_editor_context The current block editor context.
  85  	 */
  86  	$block_categories = apply_filters( 'block_categories_all', $block_categories, $block_editor_context );
  87  
  88  	if ( ! empty( $block_editor_context->post ) ) {
  89  		$post = $block_editor_context->post;
  90  
  91  		/**

PHP Documentation

<?php
/**
	 * Filters the default array of categories for block types.
	 *
	 * @since 5.8.0
	 *
	 * @param array[]                 $block_categories     Array of categories for block types.
	 * @param WP_Block_Editor_Context $block_editor_context The current block editor context.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/block-editor.php
Related Hooks

Related hooks will be displayed here in future updates.