Skip to content

Commit

Permalink
Fix block_categories deprecation warning
Browse files Browse the repository at this point in the history
Closes #12
  • Loading branch information
SimonMayerhofer committed Sep 8, 2021
1 parent 457ea95 commit 7bb2b3d
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions inc/gutenberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,15 @@ function foundationpress_gutenberg_support() {
add_action( 'after_setup_theme', 'foundationpress_gutenberg_support' );
endif;

function foundationpress_block_categories( $categories, $post ) {
/**
* Adding a new (custom) block category.
*
* @param array $block_categories Array of categories for block types.
* @param WP_Block_Editor_Context $block_editor_context The current block editor context.
*/
function foundationpress_block_categories( $block_categories, $block_editor_context ) {
return array_merge(
$categories,
$block_categories,
[
[
'slug' => 'foundationpress',
Expand All @@ -57,4 +63,4 @@ function foundationpress_block_categories( $categories, $post ) {
]
);
}
add_filter( 'block_categories', 'foundationpress_block_categories', 0, 2 );
add_filter( 'block_categories_all', 'foundationpress_block_categories', 0, 2 );

0 comments on commit 7bb2b3d

Please sign in to comment.