block_categories filter-hookWP 5.0.0

Deprecated from version 5.8.0. It is no longer supported and can be removed in future releases. See block_categories_all.

Filters the default array of categories for block types.

Usage

add_filter( 'block_categories', 'wp_kama_block_categories_filter', 10, 3 );

/**
 * Function for `block_categories` filter-hook.
 * 
 * @param array[] $block_categories Array of categories for block types.
 * @param WP_Post $post             Post being loaded.
 * @param         $string           
 *
 * @return array[]
 */
function wp_kama_block_categories_filter( $block_categories, $post, $string ){

	// filter...
	return $block_categories;
}
$block_categories(array[])
Array of categories for block types.
$post(WP_Post)
Post being loaded.
$string
-

Changelog

Since 5.0.0 Introduced.
Deprecated since 5.8.0 Use the {@see 'block_categories_all'} filter instead.

Where the hook is called

get_block_categories()
block_categories
wp-includes/block-editor.php 100
$block_categories = apply_filters_deprecated( 'block_categories', array( $block_categories, $post ), '5.8.0', 'block_categories_all' );

Where the hook is used in WordPress

Usage not found.