Last active
April 1, 2020 15:38
-
-
Save joshuacerbito/f78bdd924eee1d36971aea23dc9ed828 to your computer and use it in GitHub Desktop.
Adding a Custom Category to Gutenberg
This file contains hidden or 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( 'block_categories', function( $categories, $post ) { | |
return array_merge( | |
$categories, | |
[ | |
[ | |
'slug' => 'my-category', | |
'title' => __( 'My Custom Category', 'my-namespace' ), | |
], | |
] | |
); | |
}, 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment