Filters the default array of categories for block types.
Parameters
$block_categories
array[]- Array of categories for block types.
$post
WP_Post- Post being loaded.
Source
$block_categories = apply_filters_deprecated( 'block_categories', array( $block_categories, $post ), '5.8.0', 'block_categories_all' );
Changelog
Version | Description |
---|---|
5.8.0 | Use the 'block_categories_all' filter instead. |
5.0.0 | Introduced. |
Register a new block category for “My Plugin” if it doesn’t exist already.
Note: You can also pass a second argument
$post
to generate a different category depending on the post’s content or type.If you’ve come here because you’re getting deprecation notices about `block_categories`, as of 5.8 this filter is deprecated. Use `block_categories_all` instead.
If you need to apply categories based on post type or other $post data, you can do so like this: