Anyone know how to re-arrange, manipulate the Block Categories in the Gutenberg Editor in Wordpress I can't even return a list of them as you can with the Blocks themselves, all I can find is 'getCategories' which doesn't seem do anything... the new documentation is not great at all.
To manage your blocks, click on the add block button and then locate the Reusables tab. You'll see a link to manage your reusable blocks page. Clicking on the link will bring you to block management page. From here, you can edit, delete, export, and import your blocks.
Group block with columns, heading, paragraph, image and button blocks. To add a group block, click on the Block Inserter icon. You can also type /group and hit enter in a new paragraph block to add one quickly.
This did the trick for me to register a custom Guttenberg block and make it the first option in WP Admin editor:
function custom_block_category( $categories ) {
$custom_block = array(
'slug' => 'my-blocks',
'title' => __( 'My Test Blocks', 'my-blocks' ),
);
$categories_sorted = array();
$categories_sorted[0] = $custom_block;
foreach ($categories as $category) {
$categories_sorted[] = $category;
}
return $categories_sorted;
}
add_filter( 'block_categories', 'custom_block_category', 10, 2);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With