Last active
March 8, 2019 19:55
-
-
Save hereswhatidid/16a76072b9806abb09b89a63ca12765f to your computer and use it in GitHub Desktop.
Register custom Gutenberg block category
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function new_category( $categories, $post ) { | |
return array_merge( | |
$categories, | |
array( | |
array( | |
'slug' => 'custom-category', | |
'title' => __( 'Custom Category', 'language' ), | |
), | |
) | |
); | |
} | |
add_filter( 'block_categories', 'new_category', 10, 2); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'allowed_block_types', 'allowed_block_types' ); | |
function allowed_block_types( $allowed_blocks ) { | |
return [ | |
'core/image', | |
'core/paragraph', | |
'core/heading' | |
]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment