Gutenberg moving core blocks between categories

Although I’m unsure on how to achieve this in php, within javascript you can change the category by hooking into the blocks.registerBlockType hook.

Here is a small example how it would work, although I’d recommend using lodash to deepClone the settings object to keep everything immutable.

const rearrangeBlockCategories = {
  'core/table': 'common',
};

wp.hooks.addFilter('blocks.registerBlockType', '[namespace]', (settings, name) => {
  if (rearrangeBlockCategories[name]) {
    settings.category = rearrangeBlockCategories[name];  
  }

  return settings;

});

Leave a Comment